با سلام
با استفاده از قابلیت رویدادها در اکسل ماکرویی تهیه گردید که در صورت ورود شماره ردیف در ستون A، در سلول مجاور آن تاریخ روز به شمسی درج میگردد
کد رویداد
کد PHP:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next 'skip all run-time errorsگ'
Application.EnableEvents = False
If Not Intersect(Target, Me.Range("A2:b50000")) Is Nothing Then data
Application.EnableEvents = True
On Error GoTo 0
End Sub
کد ماکرو
کد PHP:
Sub data()
Dim i, J As Integer
Dim rowNumberValue As Integer, columnNumberValue As Integer
rowNumberValue = ActiveCell.Row
columnNumberValue = ActiveCell.Column
If Cells(rowNumberValue, 1) <> "" And Cells(rowNumberValue, 2) = "" Then
Cells(rowNumberValue, 2) = J_TODAY(1)
ElseIf Cells(rowNumberValue - 1, 1) <> "" And Cells(rowNumberValue, 2) = "" Then
Cells(rowNumberValue - 1, 2) = J_TODAY(1)
End If
End Sub
علاقه مندی ها (Bookmarks)