Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell | Excel Discussion (Misc queries) | |||
How do I move a document from "recent items" to "documents" | New Users to Excel | |||
Excel "Move or Copy" and "Delete" sheet functions | Excel Worksheet Functions | |||
change "true" and "false" to "availble" and "out of stock" | Excel Worksheet Functions | |||
Getting "compile error" "method or data member not found" on reinstall | Excel Programming |