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

جمع اللون الاصفر بالخلية


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

شكرا اخى مهند

بس تعال طبقها فى الملف المرسل لا تعمل  لانى عامل اللون CONDITION FORMATING

حاول تطبيقها

انا بحثت ولقيت بالفعل بالمنتدى ولكن عند التطبيق فى الشيت لاتعمل لان اللوا بيأتى AUTOMATIC  من CONDITION FORMATTING

افتح ملفى المرفق وانت هتفهم شو قصدى

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

أخى الفاضل

تم تعديل كود اخى الحبيب ياسر ليناسب طلبك

Sub CountCells()
    Dim Cel As Range, x
    Dim Total As Integer
    Application.ScreenUpdating = False
            For Each Cel In ActiveSheet.Range("d7:J7")
                x = GetCellColorForReals(Cel)
                If x <> 16777215 Then
                Total = Total + Cel.Value
                End If
            Next Cel
            Range("L7") = Total
    Application.ScreenUpdating = False
End Sub

Function GetCellColorForReals(R As Range) As Long
    GetCellColorForReals = R.DisplayFormat.Interior.Color
End Function

 

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

Sub CountCells()
    Dim Cel As Range, x
    Dim Total As Integer
    Application.ScreenUpdating = False
            For Each Cel In ActiveSheet.Range("d7:J7")
                x = GetCellColorForReals(Cel)
                If x <> 16777215 Then
                Total = Total + Cel.Value
                End If
            Next Cel
            Range("K7") = Total
    Application.ScreenUpdating = False
End Sub

Function GetCellColorForReals(R As Range) As Long
    GetCellColorForReals = R.DisplayFormat.Interior.Color
End Function
Sub CountCells()
    Dim Cel As Range, x
    Dim Total As Integer
    Application.ScreenUpdating = False
            For Each Cel In ActiveSheet.Range("d7:J7")
                x = GetCellColorForReals(Cel)
                If x <> 16777215 Then
                Total = Total + Cel.Value
                End If
            Next Cel
            Range("K7") = Total
    Application.ScreenUpdating = False
End Sub

Function GetCellColorForReals(R As Range) As Long
    GetCellColorForReals = R.DisplayFormat.Interior.Color
End Function
رابط هذا التعليق
شارك

طلعلى error 438 

لما دوست على جمع

وغيرد الكود بالفعل وبردة نفس المشكلة

Untitled.png

ياجماعة لو حد عايز يعمل ملف تانى غير بتاعى بس نفس الفكرة ماشىيكون الارقام  بين 100 و 500 معمولين باللون الاحمر با condition formation

 

شكرا واسف على تعبكم معايا

تم تعديل بواسطه أتـــــــــش
رابط هذا التعليق
شارك

تفضل فكرة جميلة لعلها تفي بالغرض

طبعا مطبق في المثال اذا كان الرقم اكبر من 100 او اقل من 500 يتغير للون الاحمر ويتم جمعه

جمع الخلايا الملونة.rar

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

بارك الله فيكم إخواني وأحبابي على الحلول الجميلة

أخي الكريم إتش

جرب الملف التالي عله يفيدك ..

Sub CountSumCF()
    Dim Ws As Worksheet, I As Integer, J As Integer
    
    Application.ScreenUpdating = False
        For Each Ws In ThisWorkbook.Worksheets
            Ws.Activate
            I = I + CountCFCells(Ws.Range("A1").CurrentRegion, Sheet1.Range("F1"), False)
            J = J + CountCFCells(Ws.Range("A1").CurrentRegion, Sheet1.Range("F1"), True)
        Next Ws
        
        MsgBox "Yellow Cells In All Sheets Count = " & I & vbNewLine & "Yellow Cells In All Sheets SUM = " & J
        Sheet1.Activate
    Application.ScreenUpdating = True
End Sub

Function CountCFCells(Rng As Range, C As Range, bCount As Boolean)
    Dim I As Single, J As Long
    Dim Chk As Boolean, Str1 As String, CFCELL As Range
    Application.Volatile
    Chk = False
    
    For I = 1 To Rng.FormatConditions.Count
        If Rng.FormatConditions(I).Interior.ColorIndex = C.Interior.ColorIndex Then
            Chk = True
            Exit For
        End If
    Next I
    
    J = 0
    If Chk = True Then
        For Each CFCELL In Rng
            Str1 = CFCELL.FormatConditions(I).Formula1
            Dim II As Integer
            Dim IIFlg As Boolean
            Dim Tmp
            IIFlg = False
            For II = 1 To Len(Str1)
                Tmp = Mid(Str1, II, 1)
                If ("0123456789" Like "*" & Tmp & "*") Then
                    IIFlg = True
                Else
                    If (IIFlg) Then Exit For
                End If
            Next
            Tmp = Right(Str1, Len(Str1) - II + 1)
            Str1 = "=" & CFCELL.Address & Tmp
            If bCount = False Then
                If Evaluate(Str1) = True Then J = J + 1
            Else
                If Evaluate(Str1) = True Then J = J + CFCELL
            End If
        Next CFCELL
    Else
        CountCFCells = "Color Not Found"
        Exit Function
    End If
    CountCFCells = J
    Set Rng = Nothing
    Set C = Nothing
End Function

تقبل تحياتي

Count & Sum Conditional Formatting Cells YasserKhalil.rar

  • 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