Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default VB code to move cursor 'one cell down?

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.

Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VB code to move cursor 'one cell down?


Activecell.Offset(1,0).Select

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"StargateFan" wrote in message
...
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.

Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default VB code to move cursor 'one cell down?

On Thu, 20 May 2004 11:06:05 +0100, "Bob Phillips"
wrote:


Activecell.Offset(1,0).Select


Glorious! My macro works perfectly now!

Thank you!

--

HTH


It sure did!

I know have a spreadsheet that has buttons with macros assigned to
them that are found in the workbook itself, all of which has allowed
me to put some great db-like functionality into a spreadsheet! I just
earned my pay! I found out this weekend about how to do all of this.
For years I've been assigning macros to the toolbar but not making
standalone files in this way. Excel is one of the few programs, like
WordPerfect, that has never let me down all these years. No matter
what I've needed, it's come through! Awesome!

:oD

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"StargateFan" wrote in message
.. .
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.

Thanks!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default VB code to move cursor 'one cell down?

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.

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.


--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #5   Report Post  
Posted to microsoft.public.excel.programming
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.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,979
Default VB code to move cursor 'one cell down?

You're welcome! The macro recorder doesn't produce the most efficient
code, but it's a good way to learn about the Excel object model.

Also, David McRitchie has a list of VBA tutorials that may interest you:

http://www.mvps.org/dmcritchie/excel...m#vbatutorials

StargateFan wrote:
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.





--
Debra Dalgleish
Excel FAQ, Tips & Book List
http://www.contextures.com/tiptech.html

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 171
Default VB code to move cursor 'one cell down?

On Thu, 20 May 2004 08:11:52 -0400, Debra Dalgleish
wrote:

You're welcome! The macro recorder doesn't produce the most efficient
code, but it's a good way to learn about the Excel object model.

Also, David McRitchie has a list of VBA tutorials that may interest you:

http://www.mvps.org/dmcritchie/excel...m#vbatutorials


Thank you so much for this! As a PSP/Bryce/Poser user, I'm very keen
on tutorials!! <lol One always learns a lot from them.

StargateFan wrote:
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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
macro to move cursor one cell right Kodak1993 New Users to Excel 3 September 23rd 08 02:00 AM
Move cursor to...on exiting cell furnaceman Excel Discussion (Misc queries) 3 June 5th 07 04:00 PM
Automatically move cursor when cell value changes scotty New Users to Excel 3 January 23rd 07 12:03 AM
Automatically move cursor when cell value changes scotty New Users to Excel 0 January 19th 07 08:15 PM
How do I get tab to move the cursor one cell over rather than 8? Mysti4God Excel Worksheet Functions 2 August 11th 06 07:04 PM


All times are GMT +1. The time now is 09:34 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"