C
CrankyLemming
Hi, I hope someone can help with this.
This is probably really obvious, but I've got the following code held
on Sheet 2 of a 3 sheet document. The cells concerned are filled by
data from Sheet 1: =Sheet1!A6, for example. I can't see why it wont
work.
Basically, I want those A-column cells on Sheet 2 which don't hold a
value (their corresponding sheet on Sheet 1 is empty) to hide their
row. I've tried ascribing a value in the 'If cell.Value=' section.
(The cells are formatted for dates. A nil return is giving me
00-Jan-00; I've tried using If cell.Value<01-Jan-00, and 01-Jan-2003)
The code is:
Private Sub Worksheet_Change(ByVal Target As Range)
'Hide empty rows
Set rng = Range("A6:A21" & Range("A" & Rows.Count).End(xlUp).Row)
For Each cell In Range
If cell.Value = "" Then cell.EntireRow.Hidden = True
Next cell
End Sub
Any answers would be greatly appreciated.
Steve
This is probably really obvious, but I've got the following code held
on Sheet 2 of a 3 sheet document. The cells concerned are filled by
data from Sheet 1: =Sheet1!A6, for example. I can't see why it wont
work.
Basically, I want those A-column cells on Sheet 2 which don't hold a
value (their corresponding sheet on Sheet 1 is empty) to hide their
row. I've tried ascribing a value in the 'If cell.Value=' section.
(The cells are formatted for dates. A nil return is giving me
00-Jan-00; I've tried using If cell.Value<01-Jan-00, and 01-Jan-2003)
The code is:
Private Sub Worksheet_Change(ByVal Target As Range)
'Hide empty rows
Set rng = Range("A6:A21" & Range("A" & Rows.Count).End(xlUp).Row)
For Each cell In Range
If cell.Value = "" Then cell.EntireRow.Hidden = True
Next cell
End Sub
Any answers would be greatly appreciated.
Steve