+ Reply to Thread
Results 1 to 14 of 14

Macro name not in the list

  1. #1
    Registered User
    Join Date
    10-25-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    28

    Macro name not in the list

    I am using Excel 2010. I have created a macro through Visual Basic. I couldn't see the macro name in the list when I clicked Macros. Why? I need to type in the name in the dialogue box to run the macro. Please help. Thanks

  2. #2
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Macro name not in the list

    Hi tywlam and welcome to the forum,

    Is the Macro behind a Worksheet and Private or is it in a Module and Public?
    That might be the problem.
    One test is worth a thousand opinions.
    Click the * Add Reputation below to say thanks.

  3. #3
    Registered User
    Join Date
    10-25-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Macro name not in the list

    Thanks for your reply. It is in a Module. I am learning wrirting simple VBA from an On-line tutorial which shows that Excel 2007 can show the name on the list but my Excel 2010 can't!

  4. #4
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Macro name not in the list

    In Excel 2010 I just created a Sub named BOB.
    Click on Macros and it shows it.

    Can you attach you file? It should show in 2010 without a problem.

    Do you have an End Sub at the end?
    Have you compiled it?
    Do you have code running that is keeping you from starting another macro? That is are you in break mode?
    In the Macro Dialog near the bottom it askes for "Macros in:" Is the macro in an open workbook?

  5. #5
    Registered User
    Join Date
    10-25-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Macro name not in the list

    I have "End Function" instead. See below. The macro is in an open workbook. I don't know how to attach the Excel file.


    Function SimpleCoinToss1()
    CountHeads = 0
    For i = 1 To 10
    SingleToss = Round(Rnd(), 0)
    CountHeads = CountHeads + SingleToss
    Next i
    Result = MsgBox("You got " & CountHeads & " Heads.", vbOKOnly)
    End Function

  6. #6
    Forum Guru MarvinP's Avatar
    Join Date
    07-23-2010
    Location
    Woodinville, WA
    MS-Off Ver
    Office 365
    Posts
    16,168

    Re: Macro name not in the list

    Hi,

    Functions aren't Subroutines. A function will not be listed in the Macro List.
    Change the word Function to Sub and see if that does it.

    To attach a file - click on Go Advanced and then on the Paper Clip Icon above the message area.

  7. #7
    Registered User
    Join Date
    10-25-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Macro name not in the list

    It doesn't even if I change to Sub!
    See attached.
    Attached Files Attached Files

  8. #8
    Registered User
    Join Date
    10-25-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Macro name not in the list

    Pls check out below. It shows it works in Excel 2007.

    http://excelmontecarlo.com/19a_run_m...worksheet.html

  9. #9
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Macro name not in the list

    have tried MarvinP it works for me...
    Please Login or Register  to view this content.
    do we have the save prog.?

    by the way if you insist in using functions you can call (run) with by typing in any cell =SimpleCoinToss1() -hit enter
    HTH
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  10. #10
    Registered User
    Join Date
    10-25-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Macro name not in the list

    It doesn't work for me and displays error message as attached.
    Attached Files Attached Files

  11. #11
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: Macro name not in the list

    should be

    Sub SimpleCoinToss1()

    not

    Function SimpleCoinToss1()
    Last edited by vlady; 10-26-2011 at 03:25 AM.

  12. #12
    Registered User
    Join Date
    10-25-2011
    Location
    Hong Kong
    MS-Off Ver
    Excel 2010
    Posts
    28

    Re: Macro name not in the list

    Thanks MarvinP and vlady. It works if using Sub
    But I just wonder why the Function works in Excel2003 but not Excel2010!

  13. #13
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Macro name not in the list

    Are you sure it works in xl2003?

    As far as I am aware only subs with no compulsary arguments will appear in the Macro dialog.
    Cheers
    Andy
    www.andypope.info

  14. #14
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Macro name not in the list

    Functions have never appeared in the macros dialog (other than perhaps XLM).
    Remember what the dormouse said
    Feed your head

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1