Thread
:
Colour specific cell based on 2 other cell values
View Single Post
#
2
Posted to microsoft.public.excel.programming
Don Guillett
external usenet poster
Posts: 10,124
Colour specific cell based on 2 other cell values
This should be quick.
sub colorif()
for i= 2 to cells(rows.count,"a").end(xlup).row
if cells(i,"v")="Yes" or cells(i,"f")="Yes" then
cells(i,"v").interior.colorindex=4
cells(i,"f").interior.colorindex=4
end if
next i
end sub
--
Don Guillett
SalesAid Software
"bony_tony" wrote in message
ups.com...
Hi, I've got spreadsheet with a list of clients, each client having
their own row.
I have recorded a macro which goes through each client and fills in
colour on the Q column if they have a "Yes" on either column V or F.
The clients are numbered on column A (I use the last client to
determine how far down to go). The problem I have is that my macro is
a bit too slow for my liking. Any ideas on an improvement?
Dim clients As Variant
Dim distance As Variant
Range("A2").Select
Selection.End(xlDown).Select
distance = 0
clients = ActiveCell
Range("F3").Select
Do Until distance = clients
If ActiveCell = "Yes" Then
ActiveCell.Offset(0, 11).Range("A1").Select
With Selection.Interior
.ColorIndex = 4
.Pattern = xlSolid
End With
ActiveCell.Offset(1, -11).Range("A1").Select
Else
ActiveCell.Offset(0, 16).Range("A1").Select
If ActiveCell = "Yes" Then
ActiveCell.Offset(0, -5).Range("A1").Select
With Selection.Interior
.ColorIndex = 4
.Pattern = xlSolid
End With
ActiveCell.Offset(1, -11).Range("A1").Select
Else
ActiveCell.Offset(1, -16).Range("A1").Select
End If
End If
distance = distance + 1
Loop
End Sub
Reply With Quote
Don Guillett
View Public Profile
Find all posts by Don Guillett