+ Reply to Thread
Results 1 to 4 of 4

activecell reference from command button

Hybrid View

  1. #1
    Registered User
    Join Date
    05-06-2009
    Location
    California
    MS-Off Ver
    Excel 2007, or 2003
    Posts
    2

    activecell reference from command button

    Hi all. I have about 200 command buttons on my spreadsheet. Since there are so many of these, I would like to create a VBA routine to determine the cell name four cells over from the cell each command button sits inside, if possible (each command button is small and sits within its own cell). So the command button in cell F1, will let me pull the data or get the cell name of cell C2. So I guess I am trying to figure out how to do relative references from a command button. Then this will be put in a public variable and passed to a subroutine which is the same for each command button. Only the data in the cells relative to the command button changes. I thought activecell might be useful for this, but you when press a command button, it doesn't make that cell the active cell.

    I just thought there might be a simple solution for this, instead of having each single command button have its own subroutine just so each one can reference cells. All I really need is to run the same subroutine with variables from 200 cells, one at a time. Sorry if my explanation is poor.. Thanks!
    Last edited by bangdakuan; 05-07-2009 at 05:12 PM.

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: activecell reference from command button

    Hi ,

    Welcome to the board.

    Assuming the command buttons are ActiveX controls (i.e. they're from the Control Toolbox) this post should lead you in the right direction.

    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Registered User
    Join Date
    05-06-2009
    Location
    California
    MS-Off Ver
    Excel 2007, or 2003
    Posts
    2

    Re: activecell reference from command button

    Hey, thanks a lot for that help. It put me on the right path, and I got it solved. Awesome job!

  4. #4
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: activecell reference from command button

    You're welcome and thanks for taking the time to mark the thread as solved

+ 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