ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro to perform action based on value in cell (https://www.excelbanter.com/excel-programming/391805-macro-perform-action-based-value-cell.html)

Jackie

Macro to perform action based on value in cell
 
Hi-

I am trying to create a macro to hide rows based on the text value in cell
A1.
If A1 = N/A, hide rows 48 through 56. Sheet is called Monthly Statement.
A1 has an iserror formula that returns N/A if an error and a number if not.

Thanks.

Brian

Macro to perform action based on value in cell
 
Sub Macro1()
If Cells(1, 1) = "N/A" Then '1,1 is the row & column for cell A1
Rows("48:56").Select
Selection.EntireRow.Hidden = True
Else
Rows("48:56").Select
Selection.EntireRow.Hidden = False
End If
End Sub


"jackie" wrote:

Hi-

I am trying to create a macro to hide rows based on the text value in cell
A1.
If A1 = N/A, hide rows 48 through 56. Sheet is called Monthly Statement.
A1 has an iserror formula that returns N/A if an error and a number if not.

Thanks.



All times are GMT +1. The time now is 07:27 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com