VBA using an image as a toggle switch

  • Thread starter Thread starter DonH
  • Start date Start date
D

DonH

Hi hope you can help.

I know next to nothing about VBA and have adapted code below from stuff I
had.

I simply want to show hide portions of my page to cut down on screen
clutter/information overload.

I have assigned my macro to a screen image but was wondering if I could have
a hide and unhide under the same button.

Any help would be much appreciated



Call Unl
Application.ScreenUpdating = False
Rows("25:75").EntireRow.Hidden = True
Rows("98:148").EntireRow.Hidden = True
Rows("171:221").EntireRow.Hidden = True
Rows("244:294").EntireRow.Hidden = True
Rows("317:367").EntireRow.Hidden = True
Range("K4").Select
Calculate
Call Pro


DonH
 
Call Unl
Application.ScreenUpdating = False
Rows("25:75").EntireRow.Hidden = Not Rows("25:75").EntireRow.Hidden
Rows("98:148").EntireRow.Hidden = Not Rows("98:148").EntireRow.Hidden
Rows("244:294").EntireRow.Hidden = Not Rows("244:294").EntireRow.Hidden
Rows("317:367").EntireRow.Hidden = Not Rows("317:367").EntireRow.Hidden
Range("K4").Select
Calculate
Call Pro


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)
 
Thanks Bob :-) That worked fantastically. I really am going to have to
learn VBA

Many thanks

DonH
 
Just an additional idea...

With Range("25:75,98:148,244:294,317:367").EntireRow
.Hidden = Not .Hidden
End With
 

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

Back
Top