Can I set up a macro to run when a click a moninated cell ?

G

Guest

I want to set up a macro in a worksheet to run when I click a cetain cell in
a worksheet rather than going to tools,macro,macros,clicking on the macro
name & run.
 
H

houghi

Sam said:
I want to set up a macro in a worksheet to run when I click a cetain cell in
a worksheet rather than going to tools,macro,macros,clicking on the macro
name & run.

Use a button. http://www.mrexcel.com/tip068.shtml

What I do for some things that need to be used by others is first have
one sheet with the button(s) and the cell(s) that need changing. Have an
explanation next to the cells and button and a generic information on
the sheet.
Next secure the file, so only certain cells can have data.
Then selct white as colour, so the grey lines are gone.
Put a company logo on there to impress management and it looks as if it
is something realy complicated and good. :-D

That way people who are not the into the details of what it does behind
the scenes still are able to use it easily.

houghi
 
G

Guest

Sam, there are a couple of easier ways to do it than picking on a particular
cell to activate the macro. If you just use a cell you have to then add code
to some worksheet event such as _SelectionChange or _OnDoubleClick to detect
and test which cell got selected/clicked in and then decide which macro to
run based on that test.

You can use buttons from the Forms icon toolbar (View | Toolbars | Forms) to
do the same thing easier - you put the button on a sheet and put appropriate
text in it to tell what it does. You can then right-click on it and [Assign
macro] and choose an existing macro to be run when you click on it, or you
can build a new macro associated with it that will be named something like
Button01_Click().

You can even get more creative by using shapes and text boxes from the
Drawing toolbar (again: View | Toolbars | Drawing) and you can pretty them up
with color and with the TextBox you can do some fancier things with the text
in them. You can then right-click and do the Assign Macro thing with them
also.

You can pretty much [Assign Macro] to anything you can put onto a sheet or
form in Excel - even pictures!
 

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