set macro to a cell

G

GAME.ON.GFX

How do I set a macro to go to a specific cell when my cursor hits a specified
cell?When I type down column K2, k3, k4, k5, then hit enter into k6, I want
the cursor to go back to k2.
Thanks.
 
J

JBeaucaire

You don't really need a macro for that. If you highlight cells K2:K6 and then
start typing with them highlighted, your cursor will do what you described.
 
S

Sheeloo

Attach the following to the worksheet you are working on...
Assumption: The cursor goes to K7 when you enter something in K6 and press
Enter...

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$K$7" Then
Range("K2").Activate
End If
End Sub
 
S

Sheeloo

I think you needed to go back to K2 after K5. In that case change $k$7 to $K$6.

However JBeaucaire's suggestion is much better.
 

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