Macro to perform action based on value in cell

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top