Can i do this??

M

majikman

Is it possible to hide rows in a worksheet with a macro so that it look
as if though the cells were deleted then make them reappear with
separate macro
 
B

Bob Kilmer

Option Explicit
Private mOldHeight

Sub Hide()
mOldHeight = Range(Rows(1), Rows(3)).RowHeight
Range(Rows(1), Rows(3)).RowHeight = 0
End Sub

Sub Unhide()
Range(Rows(1), Rows(3)).RowHeight = mOldHeight
End Sub

Sub Main()
Hide
MsgBox "Row Height: " & mOldHeight
Unhide
End Sub

Bob
 
A

Andrew

A simpler way would be:
Rows("4:9").EntireRow.Hidden = True

Recording a macro is a good way to figure these sort of questions out.
Go to Tools/Macro/Record Macro and then do the action that you want
to automate manually.

Cheers,
Andrew
 
Top