View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
SteveM SteveM is offline
external usenet poster
 
Posts: 133
Default offsets - using ranges

On Jan 24, 7:24 pm, Theo wrote:
This works fine:
If IsEmpty(cll.Offset(0, 1)) Then cll.Offset(0, 1).Interior.ColorIndex = 6 _
Else: cll.Offset(0, 1).Interior.ColorIndex = xlNone

I want to do the same thing but for a range of cells in the row (from colum
R to column V, for example - check to see if they are ALL empty and then
highlight ALL of them, if so).
Any help is much appreciated .


If you want to do a by-cell check, this will work

Sub CheckCells()
Dim cell as Range

For Each cell in Range("R#:V#") 'whatever the row numbers are]
If IsEmpty(cell)... Then
your code here
End If
Next

End Sub

Generally it's good practice to set the range to a range variable and
use that downstream.

Good Luck,

SteveM