View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
zz zz is offline
external usenet poster
 
Posts: 32
Default Quick Question: Buttons

this fingers!!

resuming where i accidentally hit the return key

---------------this---------------------
private sub my_suigeneris_button_click()

if the_global_var="something" then
run "My_something_sub"
else
run "my_something_else_sub"
end if

end sub



would be replaced by

--------------this-----------------------

private sub my_suigeneris_button_click()

run the_global_var

end sub



"zz" wrote in message
...
another alternative

in a normal module

sub command101
msgbox "hello world"
end sub

in the button

run "command101"

the run command calls a macro by its name, this is really useful for using
the same button to do different actions based on user input

EG.

private sub my_suigeneris_button_click()

if the_global_var="something" then
run "My_something_sub"
else
run "my_something_else_sub"
end if

end sub


--
---
zz [MX]
cuasi-musico,semi-poeta y loco


"Mazin" wrote in message
oups.com...
I have all my code in ThisWorkbook and I have a button in Sheet 1. How
do I get the button in Sheet 1 to point at some functions in
ThisWorkbook?

Thanks.