View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
RadarEye RadarEye is offline
external usenet poster
 
Posts: 78
Default Select last column

Hi Martin,

It was completly clear to me.

Sub ColorRowOnYes()
Dim lRow As Long
Dim lCol As Long

For lRow = 2 To 21
If Cells(lRow, 3).Value = "Yes" Then
If IsEmpty(Cells(lRow, 256)) Then
lCol = Cells(lRow, 256).End(xlToLeft).Column
Else
lCol = 256
End If
Range(Cells(lRow, 1), Cells(lRow, lCol)).Interior.ColorIndex = 50
End If
Next
End Sub

HTH,

Wouter