I am trying to write a simple macro that looks through 20 values and colors the cells until it reaches the value that I have specified. I believe I am having a problem with the "with" section of this code. Any help is appreciated.
Sub ColorUntil()
Dim A As Range
Dim B As Integer
A = "A4"
B = A
Range("C1:C20").Select
Do
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Loop Until ActiveCell.Value = B
End Sub
Sub ColorUntil()
Dim A As Range
Dim B As Integer
A = "A4"
B = A
Range("C1:C20").Select
Do
With Selection.Interior
.ColorIndex = 6
.Pattern = xlSolid
End With
Loop Until ActiveCell.Value = B
End Sub