select a specific ActiveCell by VBA

J

Jock

In any cell in column "F", a user can select a code number from a drop down
list. These numbers go up to over 100, so, if the user isn't sure of which
number to select, cell F6 can be rightclicked and VBA will take the user to a
different sheet where all the code numbers (and their associated meanings)
are listed.
A command button on that sheet will take the user back to the ActiveCell on
the first sheet. Even if the user was working in cell F2000, the active cell
is now always F6
To get around this, how can I set the active row to the bottom most row with
data in "C" and then Offset from that cell to then make the active cell in
"F" on the same row?
 
R

Rick Rothstein

It might have been easier for you if, instead of activating another sheet
with the information on it, you popped up a UserForm which displayed that
information to the user (even allowing him/her to select the code from the
UserForm and using that selection back on the worksheet directly). Anyway,
back to your question, try this line of code once you return to the calling
worksheet...

Cells(Rows.Count, "C").End(xlUp).Offset(0, 3).Select
 
J

JLGWhiz

Assuming the sheet the user was originally on is Sheet1

Private Sub CommandButton1_Click() 'Use actual button name
Sheets("Sheet1").Range("C2").End(xlDown).Offset(0, 3).Select
End Sub
 
F

FSt1

hi
in your command button code, you would have to de-activate code that takes
you to F6 on your dropdown sheet and replace it with code to take you to the
desire cell.

Sheets("yoursheet").Activate 'edit to suit your data
Range("C65000").End(xlUp).Offset(0, 3).Activate

based on your post, the above replacement code should do what you want.
since you didn't post any code, i'm not sure what code needs to be replaced.

regards
FSt1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top