اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

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

قام بنشر

السلام عليكم ورحمة الله

الكود التالى سيجعل تغيير المسمى الوطيفى يتغير فى نفس الخلية حال انطبقت الشروط

حتى لا يتم التغيير مرتين اذا تم الضعط على زر الماكرو مرة اخرى و بدون قصد

انسخ الكود التالى و الصقه فى محرر الاكواد و خصص له زر

Sub Update_Jopes()
Dim sh As Worksheet
Dim x As Date, y As Date, z As Date
Dim p As Integer, i As Integer, Lr As Long
Set sh = Sheets("السجل")
Lr = sh.Range("B" & Rows.Count).End(xlUp).Row
i = 2
Do While i <= Lr
If IsDate(Range("D" & i)) Then
x = Range("D" & i).Value
y = Date
p = Year(y) - Year(x)
If p >= 4 Then
z = DateAdd("yyyy", 4, x)
sh.Cells(i, 3) = WorksheetFunction.VLookup(Cells(i, 3), _
Sheets("تغيير الدرجة").Range("A2:B27"), 2, 0)
sh.Cells(i, 4) = z
Else
sh.Cells(i, 3) = sh.Cells(i, 3)
sh.Cells(i, 4) = sh.Cells(i, 4)
End If
End If
i = i + 1
Loop
End Sub

 

  • Like 1

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