وعليكم السلام ورحمة الله وبركاته
CODE
Sub SavePassword()
Dim chars As String
Dim password As String
Dim i As Integer
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*()_+-="
For i = 1 To 9
password = password & Mid(chars, Int(Rnd() * Len(chars) + 1), 1)
Next i
Dim wb As Workbook
Dim ws As Worksheet
Set wb = ThisWorkbook
Set ws = wb.Sheets("Sheet1") ' تحديد ورقة العمل المناسبة
ws.Range("A1").Value = password ' حفظ الرقم السري في الخلية A1
MsgBox "تم حفظ الرقم السري بنجاح!"
End Sub
CODE
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$B$2" And Target.Value = True Then
Range("C2").Value = Date
End If
End Sub