View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
BeSmart BeSmart is offline
external usenet poster
 
Posts: 102
Default Change code to look at a range of columns not a single column

Hi All

Could someone help me - I need to change the following code to look at the
range of columns "D:"BJ" and apply the formatting - rather than just looking
at column D? I've tried a few things and they haven't worked (I get error
msgs so I'm obviously doing it wrong)...

Where "D" appears below, I need it to look & apply to a range of "D:"BJ".

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Cell As Integer
Dim Z As Integer

For Z = 17 To Cells(Rows.Count, "C").End(xlUp).Row
For Cell = 43 To Cells(Rows.Count, "A").End(xlUp).Row
If Cells(Cell, "A").Value Like "*" & Range("C" & Z).Value & "*" Then
If Cells(Cell, "D").Value "0" Then
Cells(Cell, "D").Interior.Color = Range("C" & Z).Interior.Color
End If
End If
Next Cell
Next Z
End Sub
--
Thank for your help in advance
BeSmart