Afro_Cookie
Board Regular
- Joined
- Mar 17, 2020
- Messages
- 103
- Office Version
- 365
- Platform
- Windows
I am using =Datedif() to determine time frame of some stock. It's currently set into a pivot table as I only need some of the data from the main workbook, which is different to the workbook I am using. Because not each row has a date reference, there are a number of them that show a #VALUE! error. I've added =IFERROR() to hide these, simply to make it look pretty.
I have a macro that hides the cells with the correct value (14), but I want to select the cells below it until the next non error cell as well. The reason I want to hide them is so that I can generate an e-mail of visible cells and send it out.
Any help would be appreciated.
I have a macro that hides the cells with the correct value (14), but I want to select the cells below it until the next non error cell as well. The reason I want to hide them is so that I can generate an e-mail of visible cells and send it out.
Any help would be appreciated.
VBA Code:
Sub Example()
Dim cel As Range, rng As Range
Set rng = Range("A1", Range("A500").End(xlUp))
For Each cel In rng
If cel.Value <= 14 Then
cel.EntireRow.Hidden = True
End If
Next cel
End Sub