Go to another cell on another worksheet

E

Editor

Excel 2002 - Two worksheets in a workbook. When hitting enter in cell L30 on
1st worksheet, want cursor to go to cell B5 on 2nd sheet.
Can tihs be done?
 
K

Kevin B

Press Alt + F11 to open the Visual Basic Editor and double click the
worksheet that has cell L30 that is to act as the trigger.

In the module window there are 2 combo boxes at the top of the
window,directly below the toolbars.

Set the combobox on the right to Worksheet and the one one the left to Change
and enter the following code or copy and paste out of this reply. You will
need to change the entry that says Sheet2 to the worksheet that has the cell
you want selected when L30 is updated:

If Target = Range("L30") Then
With ThisWorkbook.Worksheets("Sheet2")
.Activate
.Range("B5").Select
End With
End If


When finished it should look like this:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target = Range("L30") Then
With ThisWorkbook.Worksheets("YourSheetName")
.Activate
.Range("B5").Select
End With
End If

End Sub

Now, when you update L30 it will automatically move you to cell B5 in the
stated worksheet.
 
E

Editor

When entering info in the combo boxes I, the boxes were reversed from your
instructions - is this correct?

Is there anything that needs done to activate the code - it was entered
without any errors, but doesn't seem to work?

Thanks.
 

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