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

Combine Two Private Sub Worksheet_Change


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

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

الأخوة الأعزاء

 

بالملف المرفق (BOOK1) كود لمحاذاة الأرقام بالمنتصف ، وبالملف الثانى (BOOK2) كود يقوم بتغيير إسم الشيت وفقاً للإسم المدخل بالخلية (D42).

 

برجاء التكرم بدمج الكودان فى كود واحد.

 

خالص شكرى وتقديرى

 أخوكم

عيد مصطفى

Book1.rar

Book2.rar

رابط هذا التعليق
شارك

السلام عليكم

جرب هذا

Private Sub Worksheet_Change(ByVal Target As Range)

Dim MyRange As Range
If Target.Address = "$D$42" Then ActiveSheet.Name = Left(Target.Value, 10)
Set MyRange = Union([J5:J27], [L10:P27], [P40:P44])
If Intersect(Target, MyRange) Is Nothing Then Exit Sub
 
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
  
       For Each Ce In MyRange
       If IsNumeric(Ce) = False Then GoTo 1
With Ce
       .NumberFormat = "_(#,##0.00_);[Red]_((#,##0.00);_(--_);_(@_)"
        If .Value = 0 Then
       .HorizontalAlignment = xlCenter
       .VerticalAlignment = xlCenter
        Else
       .HorizontalAlignment = xlRight
       .VerticalAlignment = xlCenter
  End If
  End With
1 Next Ce
  Application.ScreenUpdating = True
  Application.Calculation = xlCalculationAutomatic
  
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.

×
×
  • اضف...

Important Information