dpaton05
Well-known Member
- Joined
- Aug 14, 2018
- Messages
- 2,352
- Office Version
- 365
- 2016
- Platform
- Windows
I have some code that is meant to look at the bottom 8 rows in a spreadsheet and if column D has a 0 or nothing in that cell for each row, it is meant to hide the row. What is wrong with the code I wrote as it won't work?
Sub SecondNMore()
Dim cell As Range, n As Long, e As Long, f As Long, i As Long
e = Range("D" & Rows.Count).End(xlUp).Row
'f = Range("D56").End(xlDown).Row
For Each cell In Range("D" & e - 8 & ":D" & e)
If cell.Value = "" Or cell.Value = 0 Then Rows(e).Hidden = True
e = e - 1
Next cell
End Sub
Sub SecondNMore()
Dim cell As Range, n As Long, e As Long, f As Long, i As Long
e = Range("D" & Rows.Count).End(xlUp).Row
'f = Range("D56").End(xlDown).Row
For Each cell In Range("D" & e - 8 & ":D" & e)
If cell.Value = "" Or cell.Value = 0 Then Rows(e).Hidden = True
e = e - 1
Next cell
End Sub