Hi, I've two Excel with Macro files. I copied a couple of pages from one to another. I had two macros, one for exporting to Pdf which is working fine also in the new file, and another one that would hide/show a section of a document.<br>This second one keeps giving error, while in the older file it's still working fine.<br>I don't understand why it's giving error. Can somebody help?
Sub ShowHideHP2() ' RemovePbreak Macro Sheets("QUOTE").Select Rows("318:536").Select If Selection.EntireRow.Hidden = True Then Selection.EntireRow.Hidden = False 'Add Row Page Break Worksheets("QUOTE").Rows(318).PageBreak = xlPageBreakManual Worksheets("QUOTE").Rows(405).PageBreak = xlPageBreakManual Worksheets("QUOTE").Rows(471).PageBreak = xlPageBreakManual Else Selection.EntireRow.Hidden = True (ON THIS LINE IS GIVING ERROR) 'Clear Row Page Worksheets("QUOTE").Rows(318).PageBreak = xlPageBreakNone Worksheets("QUOTE").Rows(405).PageBreak = xlPageBreakNone Worksheets("QUOTE").Rows(471).PageBreak = xlPageBreakNone End If Sheets("Main calcs").Select End Sub