how to create a zoom butom in vba excel

V

vvv

hey guys how do I create a button (vba code) that upon each click changes the
zoom of the workshet?
 
J

Jacob Skaria

You can. Try
'to zoom out
ActiveWindow.Zoom = (ActiveWindow.Zoom-10)

to zoom in
ActiveWindow.Zoom = (ActiveWindow.Zoom+10)

If this post helps click Yes
 
D

Dave Peterson

You could record a macro to get the syntax and modify that recorded macro to do
what you want.

Then you could place a button from the Forms toolbar on the sheet and assign
this macro to the button.

But an alternative would be to add a couple of buttons to your favorite toolbar
(xl2003 and earlier).

In xl2003 menus:
Tools|Customize|Commands tab|View Category
Scroll down in the commands listbox until you see:
Zoom In
and drag it to your favorite toolbar
Do the same with Zoom out

I don't know if the same icons are available in xl2007 so that you can add them
to the QAT.

By putting these icons on your favorite toolbar (or QAT if available), you'll
have this functionality in all worksheets.
 

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