offset/macro problem

M

maacmaac

I want to hide certain rows given a certain value. I.E. if a user
enters a value of 3 securities, I want to hide rows 14-40. If a user
enters a value of 6 securities, I want to hide rows 17-40.

I have tried to write a macro using the offset button, but cannot get
it to work.

Any help? See attached file.

Thanks.

Sub HideRows()
'
'
'
Rows.Offset("G4+11:40").Select
Range("B14").Activate
Selection.EntireRow.Hidden = True
Range("B3").Select
End Sub

Attachment filename: loop.macro.problem.xls
Download attachment: http://www.excelforum.com/attachment.php?postid=382425
 
B

Bob Phillips

Mac,

Try

Sub HideRows()
'
'
'
Rows.Offset("A14:A40").EntireRow.Hidden = True
End Sub

Just add the test for the n um and add a line for 17-40


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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

Top