+ Reply to Thread
Results 1 to 7 of 7

Subroutine does not appear in the "Assign Macro" dialog box

  1. #1
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Subroutine does not appear in the "Assign Macro" dialog box

    Hi,

    I have some vba code. Several subroutines are in this code. I want to assign a macro to a forms button. I have inserted the form and when i right click on it i see the assign macro. When i click on assign macro there is a list of assignable macros.........problem is i dont see the subroutine in the list that i want. How do i get the subroutine that i want to show up in this list so i can assign it to a forms button?

  2. #2
    Valued Forum Contributor Sean Thomas's Avatar
    Join Date
    03-25-2012
    Location
    HerneBay, Kent, UK
    MS-Off Ver
    Excel 2007,2016
    Posts
    971

    Re: Subroutine does not appear in the "Assign Macro" dialog box

    is the sub routine marked: Private
    if so remove the word private and it should appear
    Regards
    Sean

    Please add to my reputation if you think i helped
    (click on the star below the post)
    Mark threads as "Solved" if you have your answer
    (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code:
    [code] Your code here [code]
    Please supply a workbook containing example Data:
    It makes its easier to answer your problem & saves time!

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Subroutine does not appear in the "Assign Macro" dialog box

    In the "macros in" menu (Above the description), there is drop down arrow. The code might be on one of "All open workbooks, personal workbooks or this workbook.
    Last edited by AB33; 12-30-2014 at 07:28 AM.

  4. #4
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Subroutine does not appear in the "Assign Macro" dialog box

    the subroutine is not marked private.......

    the only excel file open is the one i am working on............

    what i found out is this:
    i coped a subroutine from another file and pasted it into macro. closed the copied from file so only the one file is open. This new subroutine does not show up in the "assign to macro" list. However, if i go into the code and type in
    "Sub XYZ"

    then this "XYZ" subroutine DOES show up in the "assign to macro list"

    very strange....any idea why this would be the case why a cut-n-paste routine would not show up but one i "type" in would?

  5. #5
    Forum Guru JosephP's Avatar
    Join Date
    03-27-2012
    Location
    Ut
    MS-Off Ver
    2003/10
    Posts
    7,328

    Re: Subroutine does not appear in the "Assign Macro" dialog box

    if your routine is declared with arguments it won't appear in the macros dialog
    Josie

    if at first you don't succeed try doing it the way your wife told you to

  6. #6
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Subroutine does not appear in the "Assign Macro" dialog box

    Where is the macro saved? In This workbook or Personal workbook?

  7. #7
    Forum Contributor
    Join Date
    12-01-2007
    Location
    USA-North Carolina
    MS-Off Ver
    MS Office 2016
    Posts
    2,712

    Re: Subroutine does not appear in the "Assign Macro" dialog box

    stored in this workbook.

    JosephP. thanks this seems to fit........dont know why this is but seems to be the case. thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Macro that changes # format doesn't work. Press "run," dialog box disappears, no error msg
    By OldManLearningExcel in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-04-2013, 11:42 PM
  2. [SOLVED] Assign Categories for Time of Day: "Morning", "Afternoon", "Evening"
    By long_shanks in forum Excel General
    Replies: 3
    Last Post: 06-11-2013, 02:59 AM
  3. [SOLVED] Cancelling "Open" dialog box when prompted macro
    By DeRo22 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-09-2013, 01:17 PM
  4. Replies: 5
    Last Post: 02-14-2012, 01:45 AM
  5. Open "New Database Query" Dialog box thru macro
    By Kavita Salve in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-20-2010, 06:51 AM

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