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 May 3rd, 2002, 02:19 PM   #1
nancyo
Board Regular
 
Join Date: Mar 2002
Location: Massachusetts, USA
Posts: 255
Default

I have a macro which was in an unnamed module in a file (i.e. module 4). I selected the module, F4, and typed in a name for the module.

When I went to tools/macro/macro to list all the macros, it listed the macro name twice
(i.e. NewTC.NewTC). Any idea why this would happen?

I had to go thru my spreadsheets and re-assign all the macro buttons. Am I missing something simple?

BTW, each module only has one macro in it.

Or is it just friday PM...

[ This Message was edited by: nancyo on 2002-05-03 13:20 ]
nancyo is offline   Reply With Quote
Old May 3rd, 2002, 03:30 PM   #2
NateO
Legend
 
NateO's Avatar
 
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
Default

Maybe you have two macros named NewTC in the same workbook. Renaming the module is not the same as renaming the 'procedure' (macro) in that module. Rename this macro and see what happens (no need to rename the module).

Hope this helps.
__________________
Regards,
Nate Oliver
Microsoft Excel MVP
Nate's Excel Blog
NateO is offline   Reply With Quote
Old May 6th, 2002, 06:11 AM   #3
nancyo
Board Regular
 
Join Date: Mar 2002
Location: Massachusetts, USA
Posts: 255
Default

It appears that the full name of the macro will include the module name as well when both are named. As long as I know this, I'm OK. I fixed what I need so far this AM, and will remember this from now on. Thanks!!!
nancyo is offline   Reply With Quote
Old May 6th, 2002, 01:21 PM   #4
NateO
Legend
 
NateO's Avatar
 
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
Default

Nancy, I don't think that's true, it certainly isn't the case in xl 2000. I still think you have two macros in that workbook with the same name. Better double check.
__________________
Regards,
Nate Oliver
Microsoft Excel MVP
Nate's Excel Blog
NateO is offline   Reply With Quote
Old May 6th, 2002, 01:34 PM   #5
klb
Board Regular
 
Join Date: Apr 2002
Location: Minnesota
Posts: 821
Default

In Excel97 you can have two macros with the same name. If you run them, the module name will be displayed along with the macro name: module3.test or test.test.

Even though you can do it, it is not a good practice to have macros with the same name.

klb is offline   Reply With Quote
Old May 6th, 2002, 01:35 PM   #6
NateO
Legend
 
NateO's Avatar
 
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
Default

That's what I'm getting at. The tell tale sign of two macros with the same name. Same w/ 2000. You can run them from the macro dialog but not from the VBE, you'll get an ambiguity error, which I find overrated.

_________________
Cheers, NateO

[ This Message was edited by: NateO on 2002-05-06 12:37 ]
NateO is offline   Reply With Quote
Old May 6th, 2002, 02:46 PM   #7
nancyo
Board Regular
 
Join Date: Mar 2002
Location: Massachusetts, USA
Posts: 255
Default

Augh...I will look into this. I checked every single place in the workbook, no duplicate macros that I could find.

Would the macros be considered duplicate if I had two workbooks open, and copied the module from one to the other by clicking and dragging? The, the workbooks are closed, but the name of the macro appears in duplicate,
such as test.test.

Boy, I feel like an idiot. just when i think I understand something...
nancyo is offline   Reply With Quote
Old May 6th, 2002, 02:58 PM   #8
NateO
Legend
 
NateO's Avatar
 
Join Date: Feb 2002
Location: Minneapolis, Mn, USA
Posts: 9,704
Default

Nancy, no need to feel like an idiot, you're learning, as we all are. If you have two workbooks open with the a macro in each with the same name, and your macro dialog view is set to all open workbooks, the active workbook's macro will just have a name while the macro in the 2nd workbook will have the workbook's name, and ! preceeding the macro (but no module name).

A quick way to get a handle on the situation is to press alt & f8 (launch macro dialog box), highlight one of the macros, click edit and take note which module this is in. Then do the same with the second. If they're duplicates, delete one, if not, rename one.

Hope this helps.

_________________
Cheers, NateO

[ This Message was edited by: NateO on 2002-05-06 13:59 ]
NateO is offline   Reply With Quote
Old May 7th, 2002, 06:24 AM   #9
nancyo
Board Regular
 
Join Date: Mar 2002
Location: Massachusetts, USA
Posts: 255
Default

OK:

1. This AM, I only opened one workbook.

2. There are three macros in the workbook.

3. When I view the codes, they each have a different name (listed in the top, right dropdown box, and at the beginning of the code).

4. When I view the macro dialog box, there are three macros listed. Now, one of them has the double name, as well as the name of the workbook name.

5. This workbook was a copy of another workbook - that is, I opened the other file, and "saved as" with the new name. Would this have anything to do with it? How do I rename a macro?

6. I am going to look into this some more, but I am SO frustrated, I can barely stand it. This is the macro which finally works (excel to excel).
nancyo is offline   Reply With Quote
Old May 7th, 2002, 06:36 AM   #10
klb
Board Regular
 
Join Date: Apr 2002
Location: Minnesota
Posts: 821
Default

Nancy, to get rid of the "double name", change the name of the module back to Module1 or whatever number you would like. For some reason, Excel will ignore the module name if it is named Module with a number.
klb 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 05:27 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