Hi.
First of all, thanks to all the guys here who regularly help excel n00bs like me. How you get the time to do it, I will never know.
Okay.
My question: Is it possible to write a code that calls the macro with the name specified in a particular cell?
Right now I have some AutoFilter going on making a list that has
numbers 1, 2, 3...
I also have alot of macros named Search1, Search2, Search3...
So I can make a cell, say A28, that combines "Search" with whatever number is in Column C, row 29:
= "Search" & C29
Now I want to make a commandbutton that calls a macro depending on what the value of A28 is.
So if the AutoFilter should give me a list that has the value 25 in C29, then pressing the commandbutton should call the macro named Search25.
I attached a dummy workbook you can work on.
Dont worry about how the value in C29 is generated. Just know that it changes value depending on an AutoFiltered list elsewhere in the workbook.
Okay. This description turned out to be a bit longer than I expectedHopefully everything is clear.
I have tried some stuff like:
Didnt work...Dim sPrjct As String sPrjct = Sheets("Interface").Range("A28").Value Call sPrjct
I am the worst VBA n00b there is
Any help on this would be greatly appreciated
Last edited by Carlsbergen; 09-30-2009 at 07:50 AM.
You can use application.run:
but I suspect from your description that there are probably better methods. Do you actually need lots of different search macros or could you use one macro with a few variables in it?Application.Run sPrjct
That worked great! Thnx
You're probably right in that I could have made something more efficient than using a different macro for each "search".
I didnt know about this forum when I started making it and this was the only way I could think of doing it then
Next time!![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks