spiffmonkey1
New Member
- Joined
- Jun 23, 2011
- Messages
- 41
Hi, i have a macro-
Sub Changecolor()
Dim r as Long
FinalColumn = Application.WorksheetFunction.CountA(Range("D70:AIU70"))
For r = 4 To FinalColumn + 3
If WorksheetFunction.CountIf(Range(Cells(72, r), Cells(83, r)), "yes") = 1 _
And WorksheetFunction.CountIf(Range(Cells(72, r), Cells(83, r)), "N/A") = 8 _
And WorksheetFunction.CountBlank(Range(Cells(72, r), Cells(83, r))) = 3 Then
Range(Cells(70, r), Cells(70, r)).Interior.ColorIndex = 50
Range(Cells(70, r), Cells(70, r)).Font.ColorIndex = 1
Range(Cells(70, r), Cells(70, r)) = "Red" 'Text in the cell
Range(Cells(70, r), Cells(70, r)).BorderAround Weight:=xlThick
End if
next r
End Sub
I want to know if it is possible to loop this macro like a hundred times or if i can make it loop and then stop if the cell text count is the same.
Thanks
Sub Changecolor()
Dim r as Long
FinalColumn = Application.WorksheetFunction.CountA(Range("D70:AIU70"))
For r = 4 To FinalColumn + 3
If WorksheetFunction.CountIf(Range(Cells(72, r), Cells(83, r)), "yes") = 1 _
And WorksheetFunction.CountIf(Range(Cells(72, r), Cells(83, r)), "N/A") = 8 _
And WorksheetFunction.CountBlank(Range(Cells(72, r), Cells(83, r))) = 3 Then
Range(Cells(70, r), Cells(70, r)).Interior.ColorIndex = 50
Range(Cells(70, r), Cells(70, r)).Font.ColorIndex = 1
Range(Cells(70, r), Cells(70, r)) = "Red" 'Text in the cell
Range(Cells(70, r), Cells(70, r)).BorderAround Weight:=xlThick
End if
next r
End Sub
I want to know if it is possible to loop this macro like a hundred times or if i can make it loop and then stop if the cell text count is the same.
Thanks