MrExcel Message Board

Go Back   MrExcel Message Board > Question Forums > Excel Questions

Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only.

Reply
 
Thread Tools Display Modes
Old Mar 13th, 2002, 04:33 PM   #1
Igor
New Member
 
Join Date: Mar 2002
Posts: 16
Default

Hi guys.

I am sorry for bothering you all, but I have a question I cannot seem to be able to solve.

Is there any way to asign, selected macros to a button?

I have over 40 Macros in a spreadsheet, and therefore 40 Buttons.

Is there any way I can make several drop down buttons (or otherwise) that will have the ability to have selected macros as options within the drop down?

For example, of the 40 Macros, 10 are for Suppliers, and 15 are for Customers.

So I would like a button that can list for me the 10 Supplier macros, without having all the other macros within the list.

Is there a way to do this?

Any help is really appreciated.


P.S. Are there any good online VBA courses that anyone knows of?
Igor is offline   Reply With Quote
Old Mar 13th, 2002, 04:45 PM   #2
Jack in the UK
Board Regular
 
Join Date: Feb 2002
Posts: 3,064
Default

Cources

Dave Hawley on http://www.ozgrid.com does just this, not got a clue about prices thou, he post ion this site check the web page its cool stuff, loads of excel goodies, Dave has online VBA also and from what i have hurd from 2 guys i have communicated with they are super good, but ive not seen, check Dave site and his work, you decide.

BTW stick on this site wonderful reference, also everyone forget Bill (MrExcel and Juan) are top guys check this site tips and ideas are littered all over the front of this site Bill put them there for us all.

Also keep checking change all the time.



__________________
Free Excel based Web Toolbar available here.

Jack in the UK
J & R Excel Solutions
"making Excel work for you"
Jack in the UK is offline   Reply With Quote
Old Mar 13th, 2002, 07:54 PM   #3
KniteMare
Board Regular
 
Join Date: Mar 2002
Location: Hilo, Hawaii
Posts: 240
Default

You could do this by calling a userform from a button and placing your various buttons on the userform.

I have a rather complex scheduling program and I use a custom menu for this process in place of buttons or userforms. It is created upon open or activate and deleted upon deactivate or close

I did not post the code here as I gather from your note that you need more Excel VBA training. (The procedures are somewhat complex)

Have you tried the online help that comes with the VBE you just put the mouse ofer a key work and hit F1 all the related info comes up and you can branch off to your hearts content.

There are like a zillion books out there on Excel and VBA go to the book store and see if any fit you needs. remember to bring fifty bucks as they are not cheap. You will find that over time you'll buy more!!!
Good luck
Yours in EXCELent Frustration
KniteMare
KniteMare is offline   Reply With Quote
Old Mar 13th, 2002, 09:17 PM   #4
Derek
Board Regular
 
Join Date: Feb 2002
Location: Perth Australia
Posts: 1,567
Default

Hi

You might try using an input box as this is fairly simple. This little snippet calls an input box which lists macros numbered 1, 2 and 3. The number entered in the input box determines which macro runs.

Answer = InputBox("INSERT No OF THE MACRO YOU WANT TO RUN" & vbCrLf & "1. Color cell green" & vbCrLf & "2. Color cell red" & vbCrLf & "3. remove cell color")
If Answer = 1 Then Application.Run "Book12!Button2_Click"
If Answer = 2 Then Application.Run "Book12!Button3_Click"
If Answer = 3 Then Application.Run "Book12!Button4_Click"
End Sub

Hope this gives you some ideas

Regards
Derek
Derek is offline   Reply With Quote
Old Mar 13th, 2002, 09:36 PM   #5
Guest
 
Posts: n/a
Default

Why don't you just do a custom toolbar (easy, look up in help) and a drop down menu for "suppliers" with the macros below that, a drop down menu for "vendors" or whatever, with the macros for that below it, etc.
  Reply With Quote
Old Mar 13th, 2002, 10:05 PM   #6
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Hi Igor

Another way:
Suggest you change the original code to this

Private Sub ComboBox1_DropButt*******()
Dim VBCodeMod As CodeModule
Dim StartLine As Long
Dim ProcName As String
Dim VBComp

ComboBox1.Clear

For Each VBComp In ThisWorkbook.VBProject.VBComponents
If VBComp.Name = "Module1" Then
Set VBCodeMod = ThisWorkbook.VBProject.VBComponents(VBComp.Name).CodeModule
With VBCodeMod
StartLine = .CountOfDeclarationLines + 1
Do Until StartLine >= .CountOfLines
ComboBox1.AddItem .ProcOfLine(StartLine, vbext_pk_Proc)
StartLine = StartLine + .ProcCountLines(.ProcOfLine(StartLine, _
vbext_pk_Proc), vbext_pk_Proc)
Loop
End With
End If
Set VBCodeMod = Nothing
Next VBComp

End Sub


Then Insert a new Module and move all relevant code to this Module

eg In Module1 have all your code for suppliers

In another module have all code for Customers

etc.

Then just change the reference to the module in the code above......

If you like I can sen example


Ivan
Ivan F Moala is offline   Reply With Quote
Old Mar 14th, 2002, 07:25 PM   #7
Igor
New Member
 
Join Date: Mar 2002
Posts: 16
Default

Ok thanks, I'll send you what I have so far.

Thanks for all your help, its been fantastic.
Igor is offline   Reply With Quote
Old Mar 14th, 2002, 11:30 PM   #8
Ivan F Moala
MrExcel MVP
 
Ivan F Moala's Avatar
 
Join Date: Feb 2002
Location: Auckland, New Zealand
Posts: 4,209
Default

Quote:
On 2002-03-14 18:25, Igor wrote:
Ok thanks, I'll send you what I have so far.

Thanks for all your help, its been fantastic.
Hi Igor WBk recieved and amended.....
on it's way........


HTH

Ivan
Ivan F Moala is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 09:18 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
All contents Copyright 1998-2012 by MrExcel Consulting.
diabetic desserts recipes recipes Diabetic Soups Holiday Pizza Recipes Popcorn Recipes Recipes For Microwave Pasta Recipes Casserole Recipes Chili Recipes Curry Recipes Crockpot Recipes Apples Recipes Bread Recipes Vegetarian Recipes Vegetable recipes Desserts Recipes Appetizers Ethnic Recipes Meat Dishes Barbecue Recipes Sauces Recipes Marinade Recipes Low Fat Recipes Frugal Gourmet Kitchen Classics Recipes On The Grill Cook Books Seafood Recipes Cajun Recipes Breads Low Fat Low Fat Breads Bread Machine Recipes Yeast Breads Quick Breads Fat Free Vegetarian Salad Recipes Eggplant Recipes Radish Recipes Tomato Recipes Jalapeno Recipes Potato Recipes Lettuce Recipes Cabbage Recipes Beans Ambrosia Recipes Biscotti Recipes Desserts Low Fat Cookie Recipes Cheesecake Recipes Cake Recipes Pie Recipes Muffin Recipes Custard Recipes Best Appetizers Appetizers Low Fat Salsa Recipes Dip Recipes International Recipes Afghan Recipes Alaska Recipes French Recipes German Recipes Greek Recipes Italian Recipes Spanish Recipes Thai Recipes Korean Recipes Chinese Recipes Mexican Recipes Indian Recipes Beef Recipes Pork Pork & Ham Pork Butts Pork Chop Recipes Pork Ribs Rulled Pork Poultry Recipes Stews Recipes Ground Beef Barbecue Grill Barbecue Smoker All Purpose Sauce BBQ Sauce Barbecue Sauce Carolina BBQ Sauce Pickle Recipes Marinades Smoking Low Fat Appetizers & Dips Low Fat Breakfast Low Fat Cakes Low Fat Cheesecakes Low Fat Cookies Low Fat Desserts Low Fat Fish & Seafood Low Fat Meats Low Fat Pasta Low Fat Pies Low Fat Salads Low Fat Sandwiches Low Fat Sauces & Condiments Low Fat Sides Low Fat Soups Low Fat Vegetarian Baker's Dozen Taste of Home Recipe Book Bon Appetit Cookbook Blacktie Cookbook Buster Cook Book Cookbook USA Cook Book Cook Book Sara's Cookbook Sara's Cookbook Appetizers and Dips Poultry recipes Diabetic recipes Holiday recipes Miscellaneous recipes 110 recipes 1986 Usenet cookbook 2900 recipes Cyberrealm recipes Great sysops of world Specialty recipes Ceideburg recipes Cheese recipes Chili recipes Fruits recipes Garlic recipes Great chefs of NY Londontowne recipes Raisins recipes Recipes for kids US Food Vegetarian recipes Bread recipes Drinks Meat Dishes Brisket recipes Caribou recipes Chicken recipes Filet mignons recipes Pork recipes Swordfish recipes Turkey recipes Pasta recipes Uncategorized recipes Ethnic recipes Canada recipes English recipes Ethiopia recipes Germany recipes Greece recipes Mexican recipes Philippines recipes Welsh recipes Microwave recipes Soups recipes Vegetable recipes Asparagus recipes Barley recipes Brown rice recipes Lentil recipes Mushrooms recipes Salads recipes Wild rice Desserts recipes Cakes recipes Chocolate recipes Cookies recipes Ice cream recipes