View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Jay Jay is offline
external usenet poster
 
Posts: 671
Default Hiding complete Rows using a procedure

Mark -

Your procedure looks fine and works properly when I test it, although it
does have some unnecessary statements (see alternative below). Consider the
fact that all of your statements operate on the activesheet (whatever sheet
you see when you invoke the macro). Are you viewing a different sheet after
running the macro ? This would give the illusion of failure.

Try running the macro while viewing the worksheet instead of from the VB
Editor. Press Alt+F8, select your macro, and choose Run. Let us know what
happens.

Alternative:
Sub HideSetupRows()
Rows("5:7").Hidden = True
End Sub
--
Jay


"Mark Dullingham" wrote:

I want to hide rows 5,6 and 7 in a worksheet, I recorded the following macro
but it hides all rows containing data from 5 downwards.

Sub HideSetupRows()
Rows("5:7").Select
Range("B5").Activate
Selection.EntireRow.Hidden = True
Range("B8").Select
End Sub

I have no idea why this happens, could any one offer an expaination?

Thanks in advance

Mark