+ Reply to Thread
Results 1 to 7 of 7

Select Cell Based on another Cell Value

  1. #1
    Registered User
    Join Date
    06-09-2008
    Posts
    24

    Select Cell Based on another Cell Value

    Hello,

    I have a number "1" in cell Q2, and sequential numbers starting in L33 going down a few hundred rows. I would like the appropriate cell in Column L to be selected when it equals Q2, whenever Q2 is changed.

    For example, if Q2 = 1, I want L33 to be selected automatically. If Q2 is changed to 2, I want L34 to be selected automatically. If Q2 = 5, I want L37 to be selected automatically.

    Can this be done with a simply VBA script?

    Thank you.

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

    Re: Select Cell Based on another Cell Value

    Hi lespaul00,

    Is the number in cell Q2 the result of a formula (which you'll have to post for me to try and provide a solution) or just data entered?

    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
    06-09-2008
    Posts
    24

    Re: Select Cell Based on another Cell Value

    Hello. Just entered data. I do have a button that causes the value in Q2 to increase or decrease by 1, but that's it.

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

    Re: Select Cell Based on another Cell Value

    Try this worksheet event macro on the sheet in question i.e. don't put the code in a standard module:

    Please Login or Register  to view this content.
    Regards,

    Robert

  5. #5
    Registered User
    Join Date
    06-09-2008
    Posts
    24

    Re: Select Cell Based on another Cell Value

    Hello,

    Thanks for the recommendation. However, it's not working. I did add this to the specific sheet's VBA, but it does not change the cell selection when the Q2 cell changes.

    Here's a better explanation of what I am trying to do (since I realize my original explanation doesn't fully address what I am trying to do).

    Below is an image of my sheet. I am plotting rows of data. As I change the value of Q2, the row of data to plot will change. It's a way to easily click through rows of data (with visual).

    However, I would like the currently plotted row to be right up against my frozen pane at row 32. In my example below, I would like row 39 (the plotted row, shown with my conditional formatting), to be immediately after row 32 (since row 32 is my frozen pane). So, basically, I want the vertical scrolling to change as a function of the number in Q2 (which is the same as the Rank value in the third column).

    example.jpg

    I hope this is more clear!

  6. #6
    Forum Contributor
    Join Date
    07-11-2012
    Location
    india
    MS-Off Ver
    Excel 2010
    Posts
    144

    Re: Select Cell Based on another Cell Value

    Hi, lespaul00

    Small modification from "Trebor76", just change the ScrollColumn and ScrollRow based on your requirement.

    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    06-09-2008
    Posts
    24

    Re: Select Cell Based on another Cell Value

    Hello,

    Thanks for the updated code. For some reason, I get a code mismatch error on the following line when executing a separate macro I have:

    Please Login or Register  to view this content.
    Also, your code works, but only if I change the value in Q2 manually. I also have a "spinner" activex Up/Down arrow button that changes the value of Q2 in increments of 1. When I change the cell value using this, your code does not work.

    Any thoughts on these two items?

+ 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] Code to goto and select cell based on value in another cell.
    By ericv101 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-25-2014, 08:01 PM
  2. Replies: 2
    Last Post: 08-25-2014, 12:20 PM
  3. [SOLVED] Select cell in a stepwise pattern that is either blank, or based on value in other cell
    By zippityzeb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-26-2014, 08:08 AM
  4. [SOLVED] Find cell based on its text value in row 1, then select the cell directly below that
    By ks100 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-06-2014, 09:40 AM
  5. VBA select cell range based upon the # of rows that make up a certain merged cell?
    By clemsoncooz in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-04-2012, 12:22 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