+ Reply to Thread
Results 1 to 3 of 3

Passing arguments?

  1. #1
    Registered User
    Join Date
    07-22-2011
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    21

    Passing arguments?

    I have a userform with a "Submit" button on it. Ever time the user clicks on the button, I want to increase a counter variable by 1. How can i do this? It seems like either VBA won't let me pass arguments by value into a SubmitButton_Click() event, or I have no idea what I'm doing and I need a tutorial on passing arguments by value.

    Please help!

  2. #2
    Forum Expert Colin Legg's Avatar
    Join Date
    03-30-2008
    Location
    UK
    MS-Off Ver
    365
    Posts
    1,256

    Re: Passing arguments?

    ActiveX Commandbutton Click event handlers don't accept any arguments. Instead, you can declare a static variable inside the event handler and increase the value it holds by one each time the event handler is called. Static variables retain their values between calls.

    Please Login or Register  to view this content.
    Hope that helps,

    Colin

    RAD Excel Blog

  3. #3
    Registered User
    Join Date
    07-22-2011
    Location
    Boston, MA
    MS-Off Ver
    Excel 2007
    Posts
    21

    Re: Passing arguments?

    Thanks Colin. That worked perfectly.

+ 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