Got a bit of a strange one.
Looping through a group of cells, and if the cell value is blank, I want to put a value in the cell (in this case, 0).
Heres the problem. When the cells are visible, it works fine. When the cells are hidden, the activecell.text is equal to "". If I run the code on the same cells when not hidden, the text is equal to the cell value (normally a number).
Also, I'm aware I could use a Goto Special blanks on this example, but in my application the range is a lot more complicated and I would not be able to do this.
Any thoughts on why excel cannot see hidden cells .text?
Any input would be greatly appreciated! Thanks so much.
Looping through a group of cells, and if the cell value is blank, I want to put a value in the cell (in this case, 0).
Heres the problem. When the cells are visible, it works fine. When the cells are hidden, the activecell.text is equal to "". If I run the code on the same cells when not hidden, the text is equal to the cell value (normally a number).
Code:
Sub RemoveBlanks()
Range("A1").Select
While ActiveCell.Row <= Range("C10").Row
While ActiveCell.Column <= Range("C10").Column
If ActiveCell.Text = "" Then
ActiveCell.Value = 0
End If
ActiveCell.Offset(0, 1).Activate
colCounter = colCounter + 1
Wend
ActiveCell.Offset(0, 0 - colCounter).Activate
colCounter = 0
ActiveCell.Offset(1, 0).Activate
Wend
End Sub
Also, I'm aware I could use a Goto Special blanks on this example, but in my application the range is a lot more complicated and I would not be able to do this.
Any thoughts on why excel cannot see hidden cells .text?
Any input would be greatly appreciated! Thanks so much.