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

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

  • تمت الإجابة
قام بنشر

السلام عليكم 

جرب التعديل في الملف

Option Explicit

Sub CircleLowGrades()
    Dim ws As Worksheet
    Dim gradeRanges As Variant
    Dim maxRanges As Variant
    Dim cell As Range
    Dim maxCell As Range
    Dim maxGrade As Double
    Dim shp As Shape
    Dim i As Integer, j As Integer
    Dim gradeRange As Range, maxRange As Range

    Set ws = ThisWorkbook.Sheets("شهادةنصف")

    gradeRanges = Array(ws.Range("D13:P13"), ws.Range("D30:P30"), ws.Range("D47:P47"))
    maxRanges = Array(ws.Range("D12:P12"), ws.Range("D29:P29"), ws.Range("D46:P46"))

    For Each shp In ws.Shapes
        If shp.Name Like "Circle*" Then shp.delete
    Next shp

    For i = LBound(gradeRanges) To UBound(gradeRanges)
        Set gradeRange = gradeRanges(i)
        Set maxRange = maxRanges(i)

        For j = 1 To gradeRange.Cells.Count
            Set cell = gradeRange.Cells(j)
            Set maxCell = maxRange.Cells(j)
            
            If IsNumeric(maxCell.Value) Then
                maxGrade = Val(maxCell.Value)
            Else
                maxGrade = 0
            End If

            If IsNumeric(cell.Value) Then
                If Val(cell.Value) < maxGrade Then
                    Call DrawCircle(ws, cell)
                End If
            ElseIf cell.Value = "غ" Or cell.Value = "غـ" Or cell.Value = "صفر" Then
                Call DrawCircle(ws, cell)
            End If
        Next j
    Next i
End Sub

Sub DrawCircle(ws As Worksheet, cell As Range)
    Dim shp As Shape
    Set shp = ws.Shapes.AddShape(msoShapeOval, cell.Left + 2, cell.Top + 2, cell.Width - 4, cell.Height - 4)
    shp.Name = "Circle" & cell.Address(False, False)
    shp.Line.ForeColor.RGB = RGB(255, 0, 0)
    shp.Fill.ForeColor.RGB = RGB(255, 255, 255)
    shp.Fill.Transparency = 1
End Sub

test1.xlsb

  • Like 1
  • Thanks 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