+ Reply to Thread
Results 1 to 5 of 5

Passing value between Command Button and Form

  1. #1
    Registered User
    Join Date
    05-11-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    21

    Passing value between Command Button and Form

    Dear Friends,

    I am Using a Command button in my Spread sheet through which I ll be getting a value to variable " I ". I want to pass this value of " I " to a userform created in the same sheet.

    Can somebody suggest me how to perform this.

    Thanks.
    Last edited by nivassrii; 05-30-2011 at 01:17 AM.

  2. #2
    Forum Expert tigeravatar's Avatar
    Join Date
    03-25-2011
    Location
    Colorado, USA
    MS-Off Ver
    Excel 2003 - 2013
    Posts
    5,361

    Re: Passing value between Command Button and Form

    nivassrii,

    I'd recommend using a public variable. To declare a public variable, at the top of a standard module, type:
    Please Login or Register  to view this content.


    If I is a different kind of variable, just change the type from String to whatever it needs to be. Then you can just reference I in subroutines and userforms.

    Hope this helps,
    ~tigeravatar

  3. #3
    Registered User
    Join Date
    05-11-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: Passing value between Command Button and Form

    tigeravatar,

    The Idea is not working. Can you please check with my Spread Sheet attached here.
    Attached Files Attached Files

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

    Re: Passing value between Command Button and Form

    Once you show the userform modal the code lines following the show method will not execute until the userform is unloaded or hidden.

    Instead execute the commands before showing. No need for public variable.

    Please Login or Register  to view this content.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Registered User
    Join Date
    05-11-2011
    Location
    India
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: Passing value between Command Button and Form

    Thank you its working..

+ 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