+ Reply to Thread
Results 1 to 5 of 5

Eroor Passing Variable Between Module and Userform

  1. #1
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Eroor Passing Variable Between Module and Userform

    I am trying to pass a variable (etr) between a module and a userform ...

    The module calling the userform ...

    Please Login or Register  to view this content.
    The userform initialization code ...
    Please Login or Register  to view this content.
    I am getting a compile error ... "Procedure declaration does not match description of event of procedure having the same name"

    Is anyone able to help me undersatnd where I have gone wrong?

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Eroor Passing Variable Between Module and Userform

    You can't alter the Initialize event declaration, you'll need a different approach to 'pass' the variable to the userform.

    How are you going to be using the variable?
    If posting code please use code tags, see here.

  3. #3
    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,425

    Re: Eroor Passing Variable Between Module and Userform

    You probably just need to declare a public variable at the top of the module. Then set it in one subroutine and use it in the other.
    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


  4. #4
    Forum Contributor
    Join Date
    06-15-2009
    Location
    Ontario, canada
    MS-Off Ver
    Office 365
    Posts
    371

    Re: Eroor Passing Variable Between Module and Userform

    Thank you all for the quick replies!
    I'll declare the variable as public. That should work.

  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,425

    Re: Eroor Passing Variable Between Module and Userform

    You're welcome. Thanks for the rep.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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] Passing a string from worksheet module to userform.
    By jason.b75 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-13-2018, 06:10 PM
  2. [SOLVED] Passing a variable from userform to module code - value being dropped or not seen
    By nigelog in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 06-22-2018, 06:02 AM
  3. Advice on passing userform parameters to a vba class module
    By techno_gronk in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-28-2017, 06:13 AM
  4. [SOLVED] Passing a variable to a userform
    By OldMan62 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-08-2014, 12:58 PM
  5. Passing variable value from Private Sub to Module
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2009, 08:38 AM
  6. Passing a private variable to another module
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-26-2008, 02:26 PM
  7. Passing variable from userform to module error
    By mworth01 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-05-2005, 12:47 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