View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Sharad Naik Sharad Naik is offline
external usenet poster
 
Posts: 212
Default RUN a macro based on a value selected in a drop down box in a

When it gives error subscript out of range, click on Debug. It will take you
to the line in the code, where the error is actually generated. Please paste
that line here, so that we can see if we can help.

Sharad

"KrazyRed" wrote in message
...
Sussed out the last bit, now a another problem.

Says its a run time error 9, subscript out of range.

This occurs when I select either case 1 or case 2 in the drop down box.

thanks

"Sharad Naik" wrote:

Where you are writing that code?
You should wirite the code in the DropDown_Change Procedure.

Suppose the "LinkedCell" for the dropdown is 'E8' and the DropDown name
is
DorpDown1.
Then you should wirite the code in the " Private Sub DropDown1_Change"
Procedure (In disign
mode simply double click on the drop down and it will take to this
procedure.
Code can be :-
Select Case Worksheets("Sheet Name").Range("E8").Value
Case 1
Run Macro1
Case 2
Run Macro2
..and so on
End Select

Sharad

"KrazyRed" wrote in message
...
Well and truly stumped.

I have a named range which has 94 cells , each with a value that needs
to
be
selected in drop down box.

I have linked the box to the range so it is populated.

Now the problem. I have set up a macro that basically filters cells
from
another sheet into a new sheet. There is a new macro for each of the 94
entries in the range.

I want to be able to run the correct macro automatically based on the
selection in the drop down box.
I've experimented with a If and Then statement based on a cell link
number
when a value is selected in the box, but it doesn't want to work! If
<cell
range.value = "1" Then (perform macro 1) then loop through each based
on
the next selection.

Any help would be much appreciated.

--
Regards

KrazyRed