Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default VBA "move" method?

Hi ...

I need to write (or record) a macro that will simply move the the visual
cursor a specified number of cells up, down, right, left rather than using a
cell reference.

For example, if I am at D5 and run the macro, the cursor will move down 5
rows to D10 (i.e., move down 5 rows); and if I run the same macro when the
cursor is at K10, the cursor will skip down to K15.

Does anyone have some sample code you can share that shows the syntax for
up, down, right, left movement by a specified number of cells?

Thanks so much for yoru help ...

Bill Morgan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 188
Default VBA "move" method?

"bill_morgan_3333" wrote in
message
...

Hi ...

I need to write (or record) a macro that will simply move the the
visual cursor a specified number of cells up, down, right, left
rather than using a cell reference.

For example, if I am at D5 and run the macro, the cursor will move
down 5 rows to D10 (i.e., move down 5 rows); and if I run the same
macro when the cursor is at K10, the cursor will skip down to K15.

Does anyone have some sample code you can share that shows the

syntax
for up, down, right, left movement by a specified number of cells?

Thanks so much for yoru help ...

Bill Morgan


Try this:

Sub Move()
ActiveCell.Offset(5, 0).Activate
End Sub


HTH,

Alan.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default VBA "move" method?

Activecell.Offset(5,0).Select 'down

Activecell.Offset(0,5).Select 'Right

If Activecell.Column5 then
activecell.offset(0,-5).select 'left
endif

if Activecell.Row 5 Then
.Activecell..Offset(-5,0).Select 'up
End If

--

HTH

RP
(remove nothere from the email address if mailing direct)


"bill_morgan_3333" wrote in
message ...
Hi ...

I need to write (or record) a macro that will simply move the the visual
cursor a specified number of cells up, down, right, left rather than using

a
cell reference.

For example, if I am at D5 and run the macro, the cursor will move down 5
rows to D10 (i.e., move down 5 rows); and if I run the same macro when

the
cursor is at K10, the cursor will skip down to K15.

Does anyone have some sample code you can share that shows the syntax for
up, down, right, left movement by a specified number of cells?

Thanks so much for yoru help ...

Bill Morgan



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default VBA "move" method?

Alan,

Simple, and it worked perfectly. Thanks ...

"Alan" wrote:

"bill_morgan_3333" wrote in
message
...

Hi ...

I need to write (or record) a macro that will simply move the the
visual cursor a specified number of cells up, down, right, left
rather than using a cell reference.

For example, if I am at D5 and run the macro, the cursor will move
down 5 rows to D10 (i.e., move down 5 rows); and if I run the same
macro when the cursor is at K10, the cursor will skip down to K15.

Does anyone have some sample code you can share that shows the

syntax
for up, down, right, left movement by a specified number of cells?

Thanks so much for yoru help ...

Bill Morgan


Try this:

Sub Move()
ActiveCell.Offset(5, 0).Activate
End Sub


HTH,

Alan.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default VBA "move" method?

Bob,

This worked perfectly, as well.
Both of the responses I received to this question have turned me on to
getting more into Excel objects/properties/methods. I hadn't realized how
powerful (and simple) a little more typing and a little less "recording"
could be.

Thanks again ...

"Bob Phillips" wrote:

Activecell.Offset(5,0).Select 'down

Activecell.Offset(0,5).Select 'Right

If Activecell.Column5 then
activecell.offset(0,-5).select 'left
endif

if Activecell.Row 5 Then
.Activecell..Offset(-5,0).Select 'up
End If

--

HTH

RP
(remove nothere from the email address if mailing direct)


"bill_morgan_3333" wrote in
message ...
Hi ...

I need to write (or record) a macro that will simply move the the visual
cursor a specified number of cells up, down, right, left rather than using

a
cell reference.

For example, if I am at D5 and run the macro, the cursor will move down 5
rows to D10 (i.e., move down 5 rows); and if I run the same macro when

the
cursor is at K10, the cursor will skip down to K15.

Does anyone have some sample code you can share that shows the syntax for
up, down, right, left movement by a specified number of cells?

Thanks so much for yoru help ...

Bill Morgan




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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
How do I move a document from "recent items" to "documents" John Gerke in Central Oregon New Users to Excel 1 March 2nd 08 08:31 AM
Excel "Move or Copy" and "Delete" sheet functions dsiama Excel Worksheet Functions 1 December 28th 07 01:57 PM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Getting "compile error" "method or data member not found" on reinstall Bp Excel Programming 1 April 23rd 04 04:42 PM


All times are GMT +1. The time now is 03:28 PM.

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"