bahnay قام بنشر ديسمبر 22, 2017 قام بنشر ديسمبر 22, 2017 دا كود لحساب سن الطالب في أول أكتوبر الكود شغال تمام لكن على الصف الاول فقط من البيانات انا محتاج التعديل عليه ليعمل على كل الصفوف Sub a() Dim st As Date Dim ed As Date Dim st_y As Integer Dim st_m As Integer Dim st_d As Integer Dim ed_y As Integer Dim ed_m As Integer Dim ed_d As Integer Dim y As Integer Dim m As Integer Dim d As Integer '------------------------------------------ st = Range("b2") ed = Range("c1") st_y = Year(st) st_m = Month(st) st_d = Day(st) ed_y = Year(ed) ed_m = Month(ed) ed_d = Day(ed) If ed_d >= st_d Then d = ed_d - st_d Else d = 30 + (ed_d - st_d) ed_m = ed_m - 1 End If If ed_m >= st_m Then m = ed_m - st_m Else m = 12 + (ed_m - st_m) ed_y = ed_y - 1 End If If ed_y < st_y Then MsgBox "date error": GoTo theend y = ed_y - st_y If d = 30 Then d = 0: m = m + 1 If m = 12 Then m = 0: y = y + 1 ActiveSheet.Range("D2") = y ActiveSheet.Range("E2") = m ActiveSheet.Range("F2") = d theend: End Sub school.zip
الردود الموصى بها
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.