Using a cell integer to select a macro
use a worksheet change event
sub worksheet_change(byval target as excel.range)
'target is the range that was changed
'first evaluate and make sure it is the right cell
'then
select case target
case 1
macro1
case 2
macro2
case 3
macro3
case 4
macro4
case 5
macro5
case 6
macro6
case else
msgbox "Invalid entry"
end select
end sub
--
When you lose your mind, you free your life.
" wrote:
I would like to have a user enter an integer between 1 and 6 into a
cell, and then have one of six macros execute automatically depending
on what integer was entered. (As an alternative, I could use a button
to start the macro after the integer entered by telling the user to hit
the button when done). I also hope to display an error message if an
unacceptable integer is entered. I can probably figure this out if I
keep at it long enough, but help is sure appreciated.
Bob Q.
|