View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
StargateFan[_3_] StargateFan[_3_] is offline
external usenet poster
 
Posts: 171
Default VB code to move cursor 'one cell down?

On Thu, 20 May 2004 07:53:55 -0400, Debra Dalgleish
wrote:

When you record a macro, turn on Relative Reference to record cell
selection by position, instead of a specific cell address.

For example, select cell D2, and start recording.
Press the Relative Reference button on the Stop Recording toolbar
Press the down arrow key
Turn off Relative Reference, and stop recording

The resulting code is:
ActiveCell.Offset(1, 0).Range("A1").Select

When you run this code, it will move one cell down from whatever is the
active cell.


Thank you! I appreciate learning this! I'm finally getting a bit
into macro recording. And this will be of great help!

I think what stopped me from getting into this earlier is that in the
16bit days, the recorded macros didn't work in Excel and Word the way
they did in other programs. I never had luck in getting what I needed
(and it was prior 1999, when I first got online at home and then got
into ngs!). Now I find that it does a great job, just like all other
programs do. It's really opened things up for me in last year ever
since I started tentatively exploring VB-based macros (not the easiest
scripting language to get into even with years of experience in others
<lol!)

:oD

StargateFan wrote:
I have a macro in an Excel worksheet that just needs one step added,
to move the cursor one cell down from its current position. Can
someone tell me what the code for that would be?

When I add record the keystroke via moving the down arrow one cell
down, it actually adds the cell reference, which is no good.