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

ادراج FORMULA عن طريق كود VBA


إذهب إلى أفضل إجابة Solved by سليم حاصبيا,

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

السلام عليكم

اخواني اهل الخبرة

لو كان ممكنا اريد كود VBA لادراج FORMULA تعطي مجاميع مدى (c6:c21); (d6:d21) ادا تحقق الشرط    والشرط هو اسم صفحة العمل في شيت TOTAL العمود A  

حفظكم الله

TOTAL.xlsm

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

  • أفضل إجابة

ربما كان المطلوب

Sub Calcul_For_Me()
Dim i%, ALL%
Dim Fm1$, Fm2$
Dim st$
ALL = Sheets("Total").Cells(Rows.Count, 1).End(3).Row
If ALL < 5 Then Exit Sub
  With Range("B5:C" & ALL)
    .ClearContents
    .Interior.ColorIndex = xlNone
  End With
For i = 5 To ALL
    st = "ISREF('" & Cells(i, 1) & "'!A1" & ")"
    If Evaluate(st) Then
        Fm1 = "=SUM('" & Cells(i, 1) & "'!C6:C21)"
        Fm2 = "=SUM('" & Cells(i, 1) & "'!D6:D21)"
            ' Cells(i, 2).Formula = Fm1
            ' Cells(i, 3).Formula = Evaluate(Fm2)
         'OR for values Only
              Cells(i, 2) = Evaluate(Fm1)
              Cells(i, 3) = Evaluate(Fm2)
    Else
        Cells(i, 2) = "I cant Find This Sheet: " & _
        "" & Cells(i, 1) & ""
        Cells(i, 2).Interior.ColorIndex = 35
    End If
 Next
End Sub

الملف مرفق

tlayt kamal.xlsm

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

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