+ Reply to Thread
Results 1 to 5 of 5

call private sub on button click

  1. #1
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    call private sub on button click

    11826A-test.xlsm

    In the attached I have a button on the picking log tab labeled start new batch. I want to call the following code when button is clicked. How would I insert this?

    HTML Code: 

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,462

    Re: call private sub on button click

    If your workbook runs a Workbook Open event handler, it's always a good idea to make people aware of it ... just in case.

    And, if you want help with VBA inside a password protected VBA Project ...

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Contributor
    Join Date
    04-18-2013
    Location
    utah
    MS-Off Ver
    2010
    Posts
    668

    Re: call private sub on button click

    my apologies, the password is Traveler 11826A-test.xlsm

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,525

    Re: call private sub on button click

    If you are calling Private sub within a same code module, just add sub name anywhere you want.
    e.g
    Please Login or Register  to view this content.
    Otherwise you need to qualify its parent with application.Run method.
    e.g
    Please Login or Register  to view this content.

  5. #5
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,462

    Re: call private sub on button click

    Remove the "Private" key word from the module. Then right click on the button and select Assign macro and choose the module from the list.

    Regards, TMS

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to call a click button which is on another spread sheet in your MACRO
    By kbriaz in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 08-05-2013, 05:35 AM
  2. Call private sub with variable in its name
    By Willardio in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-10-2013, 11:56 AM
  3. Call Private Sub from Add-In
    By Vaw08 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-28-2013, 02:33 PM
  4. Call button click event from a button on anther sheet
    By ajaykgarg in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-25-2010, 09:27 AM
  5. call private sub from module
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-13-2009, 10:02 AM
  6. how to call a Private Sub ?
    By dpenny in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-12-2007, 01:15 PM
  7. [SOLVED] IF Statements-call private sub
    By CrimsonPlague29 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 05-11-2006, 12:00 PM
  8. [SOLVED] Call Userfor and click button with macro
    By ExcelMonkey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-25-2005, 01:06 PM

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