MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Unhide Rows problem


Posted by Bob on November 02, 2000 5:05 PM

I have a print macro that I want to run which first verifies if I want to print a memo with the other info. The memo is from row 4 to row 13. I want the memo to be hidden (which works with the following macro) if I choose no memo. But I want it to reappear if I choose yes. Why does the following work to hide the rows but not unhide them?

Public Sub PRNV()
Dim MM As Worksheet
Set MM = Sheets("MEMO")
Chk = MsgBox("WOULD YOU LIKE TO PRINT THE MEMO PORTION?", vbYesNoCancel, "MEMO CONFIRM")
Select Case Chk
Case vbYes
Application.Goto Reference:="R4C1:R13C1"
Selection.EntireRow.Hidden = False
MM.Range("A1").Select
MM.PrintOut
Case vbNo
MM.Rows("4:13").Select
Selection.EntireRow.Hidden = True
MM.Range("A1").Select
MM.PrintOut
Case vbCancel
Exit Sub
End Select
End Sub

I've tried:

MM.Rows("4:13").Select
Selection.EntireRow.Hidden = False

instead of the goto reference section, but that doesn't work either. The rows still remain hidden. Any help is greatly appreciated. Thanks.


Posted by Ben O. on November 03, 2000 7:08 AM

Hmmm...the macro worked to both hide and unhide the rows when I tried it. I copied your code directy into my VBA editor, and the only change I made was taking out the MM.PrintOut lines.

My only suggestion is, instead of selecting the rows and then hiding the selection, just hiding them without selecting them:

Rows("4:13").Hidden = True

and

Rows("4:14").Hidden = False

Both ways work for me.

-Ben