+ Reply to Thread
Results 1 to 5 of 5

how to set the active cell to the macro button's location?

  1. #1
    Registered User
    Join Date
    05-21-2013
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    3

    how to set the active cell to the macro button's location?

    hi all

    i have a command button object with the following code:
    Please Login or Register  to view this content.
    so i am trying to write the file path (selected by the user) into a cell with the same row number of the command button.
    so i thought the "ActiveCell" will automatically be the cell behind the command button, but apparently it is not so...

    how do i set the active cell to always be the cell behind the command button?
    or do you have a different idea on how to get the location VA Brief Template.xlsm(row number) where the command button is?

    i am going to have 96 buttons per sheet, plus 9 duplicates of this sheet, so i really need a generic code to by dynamic and fit all buttons...
    see attached file as an example for what i need...

    thanks!
    R.T

  2. #2
    Registered User
    Join Date
    05-21-2013
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    3

    Re: how to set the active cell to the macro button's location?

    sorry, i got the attachment text "VA Brief Template.xlsm" in the middle of the lines..

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: how to set the active cell to the macro button's location?

    Hello stingran,

    The attached workbook has the macro applied to all buttons on both sheets. The macros are in [m]Module2[/b].
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Forum Guru
    Join Date
    07-25-2011
    Location
    Florida
    MS-Off Ver
    Excel 2003
    Posts
    9,643

    Re: how to set the active cell to the macro button's location?

    You could assign all your buttons that do this thing to this one macro. It will determine the button that called the macro and reference the cell in the button's top left corner and offset one column to it's right.

    Please Login or Register  to view this content.
    Edit: ...just like Leith Ross suggests.

  5. #5
    Registered User
    Join Date
    05-21-2013
    Location
    amsterdam
    MS-Off Ver
    2010
    Posts
    3

    Re: how to set the active cell to the macro button's location?

    wow!! thanks so much for this quick help!!
    youre really great!

+ 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