+ Reply to Thread
Results 1 to 4 of 4

Pushed button caption as a macro variable

  1. #1
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Pushed button caption as a macro variable

    So when I press a button on my excel workbook a userform pops up showing that the macro is running.
    Now I want the caption of the button captured in a variable.
    And I was able to do this, however I want to use this variable in the macro that the buttons triggers.

    But the userform pop-up makes it that it first runs an other macro.
    To clarrify this is what the button triggers:

    Please Login or Register  to view this content.
    Where the caption is capture in variable A.

    But as you see this macro lauched macr 'InvMov'
    And in that macro I want to use A

    But I cannot because when the macro switched from 'MainInMov' to 'InvMov' it loses variable A.

    Any ideas how to fixed this (if possible)?
    Thanks.

  2. #2
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,303

    Re: Pushed button caption as a macro variable

    Make A a Public or Private variabe.
    Please Login or Register  to view this content.
    Last edited by bakerman2; 08-17-2016 at 06:45 AM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  3. #3
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    826

    Re: Pushed button caption as a macro variable

    Superb!
    Actually it i rather easy then to create generic variables.
    Nice

    Thanks bakerman2!

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,303

    Re: Pushed button caption as a macro variable

    You're welcome and thanks for adding rep points.

+ 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] Button caption into variable
    By JimDandy in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-15-2013, 10:08 AM
  2. Allowing only 1 toggle button pushed out of 2 choices
    By ahigh17 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2013, 11:51 AM
  3. Mouse Move not captured when button is pushed
    By dshj in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 07-31-2013, 09:03 AM
  4. [SOLVED] VBA code that looks at which worksheet button was pushed
    By whatsmyname in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-08-2013, 02:39 PM
  5. [SOLVED] Is it possible to do a comm.button with scrolling caption /changing caption?
    By Lkivagten in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-06-2012, 08:10 AM
  6. Need macro's behavior to depend on button pushed
    By JChandler22 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-29-2010, 11:46 AM
  7. [SOLVED] how to set a userform's button caption equal to a variable in the main procedure?
    By akh2103@gmail.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-11-2006, 04:25 PM
  8. [SOLVED] Execute Macro When any Built-in Autofilter Button is Pushed
    By Jay in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-12-2006, 04:45 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