Looping through a range of cells, but ignoring hidden cells
Looping through a range of cells, but ignoring hidden cells
(OP)
Hello. First time poster here. I searched, but couldn't find the answer.
I am looping through a range of cells, and I want to turn the empty cells red. However, I want to ignore hidden cells. I have figured out everything except the ignoring the hidden cells part. I get "Unabele to get the Hidden propety of the Range class."
My code is:
For Each c In Range("C3:K" & rowLimit).Cells
If (IsEmpty(c.Value)) AND (c.Hidden = FALSE)Then
c.Interior.ColorIndex = 3
End If
End If
Next
Any help is much appreciated. Thanks in advance.
Angel
I am looping through a range of cells, and I want to turn the empty cells red. However, I want to ignore hidden cells. I have figured out everything except the ignoring the hidden cells part. I get "Unabele to get the Hidden propety of the Range class."
My code is:
For Each c In Range("C3:K" & rowLimit).Cells
If (IsEmpty(c.Value)) AND (c.Hidden = FALSE)Then
c.Interior.ColorIndex = 3
End If
End If
Next
Any help is much appreciated. Thanks in advance.
Angel





RE: Looping through a range of cells, but ignoring hidden cells
You could also use conditional formatting.
Best regards
Morten
RE: Looping through a range of cells, but ignoring hidden cells
Dim c As Range
For Each c In Range("C3:K" & rowLimit).Cells
If (Not c.EntireColumn.Hidden) And (Not c.EntireRow.Hidden) Then
If IsEmpty(c.Value) Then
' Perform action
End If
End If
Next
-- Nick
RE: Looping through a range of cells, but ignoring hidden cells
Thanks for the reply. I'm processing the file and if there are any empty cells, I abort the process. But I don't care if any hidden cells are empty.
I tried conditional formatting, but I only want empty cells red at final processing. I do not know a way to turn on/off conditional formatting.
Angel
RE: Looping through a range of cells, but ignoring hidden cells
TVM for your reply. "The Hidden property applies to entire rows and columns" That was obviously the problem. It's working now.
Angel