اذهب الي المحتوي
أوفيسنا

الردود الموصى بها

قام بنشر (معدل)

السلام عليكم   ممكن دمج كودين في كود واحد

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
On Error Resume Next
     If Not Intersect(Target, Range("b1:b60000")) Is Nothing Then
      VBA.Calendar = vbCalGreg
      If IsEmpty(Target) Then
        Target(1, 2).Offset(0, -2).ClearContents
    Else
         With Target(1, 7).Offset(0, -2)
               .Value = Date
               .EntireColumn.AutoFit
           End With
       End If
End If
End Sub

الكود الثاني وهو بنفس الغرض ولكن يعمل من خلية مختلفة 

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
On Error Resume Next
     If Not Intersect(Target, Range("c1:c60000")) Is Nothing Then
      VBA.Calendar = vbCalGreg
      If IsEmpty(Target) Then
        Target(1, 2).Offset(0, -2).ClearContents
    Else
         With Target(1, 7).Offset(0, -2)
               .Value = Date
               .EntireColumn.AutoFit
           End With
       End If
End If
End Sub

هذا الملف

 

دمج كودين.rar

تم تعديل بواسطه محمد الخازمي
قام بنشر

جرب :

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
On Error Resume Next
     If Not Intersect(Target, Range("b1:b60000")) Is Nothing Then
      VBA.Calendar = vbCalGreg
      If IsEmpty(Target) Then
        Target(1, 2).Offset(0, -2).ClearContents
    Else
         With Target(1, 7).Offset(0, -2)
               .Value = Date
               .EntireColumn.AutoFit
           End With
       End If
End If
     If Not Intersect(Target, Range("c1:c60000")) Is Nothing Then
      VBA.Calendar = vbCalGreg
      If IsEmpty(Target) Then
        Target(1, 2).Offset(0, -2).ClearContents
    Else
         With Target(1, 7).Offset(0, -2)
               .Value = Date
               .EntireColumn.AutoFit
           End With
       End If
End If
End Sub

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information