Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations MikeeOK on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel Macros: how to move the cursor

Status
Not open for further replies.

Volk359

Technical User
Jun 30, 2004
395
US
What's the code for moving the cursor by row and by cell, i.e. up 1 and right 1 from it's original position?
 
First question: Why? Selecting cells slows down code. You can probably do whatever you want another way.

But, to answer your question:
Code:
ActiveCell.Offset(-1, 1).Activate
will move the cursor one row up, one column right. Arguments are: offset(RowOffset,ColumnOffset) where postive numbers move down or right, negative numbers move up or left.


[tt]_____
[blue]-John[/blue]
[/tt][red]"If you're flammable and have legs, you are never blocking a fire exit."[/red]
-Mitch Hedberg

Help us help you. Please read FAQ181-2886 before posting.
 
I've got a database that I'm cleaning up and the addresses need to be moved. The format is:

address
city, st zip

and I want to move it all on one line and preferable parse out the city-state-zip in seperate cells. This macro will allow me to click, ctrl-m, click, ctrl-m, etc. Slow but quicker than doing it manually. All the cells are in the same place respectfully so if there's a better/quicker way I'm all ears.

BTW, your code worked, thanks!
 
Glad to help[cheers]

[tt]_____
[blue]-John[/blue]
[/tt][red]"If you're flammable and have legs, you are never blocking a fire exit."[/red]
-Mitch Hedberg

Help us help you. Please read FAQ181-2886 before posting.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top