Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB in Excel

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
hi,

I want to perform the following task, by using macros in Excel:

If a CELL is empty, then the color of the whole ROW should change into RED, otherwise BLACK.

Please assist. Any help is great. Thanks.
 
In the example below, the cell A3 is hardcoded - change this to look at whatever cells you are interested in, or add a loop, ....

Dim sCol As String
Dim lRow As Long
lRow = 3
sCol = "A"
If Range("" & sCol & lRow & "").FormulaR1C1 = "" Then
Rows("" & lRow & ":" & lRow & "").Select
With Selection.Interior
.ColorIndex = 3
.Pattern = xlSolid
End With
Else
Rows("" & lRow & ":" & lRow & "").Select
With Selection.Interior
.ColorIndex = 1
.Pattern = xlSolid
End With
End If


Simon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top