ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   move cursor in excle using macro (https://www.excelbanter.com/excel-discussion-misc-queries/212819-move-cursor-excle-using-macro.html)

fdibbins

move cursor in excle using macro
 
ok, sounds dumb, but how do I move the cursor in excel a set number of lines
using a macro - cant use a cell reference because it changes all the time. I
need to cut an item in 1 cell, move down 2 lines, past it and then "enddown"
to find the next instance. I have 100's of these to do, and number of lines
between each cut/paste is never the same. I know its really simple, but just
cant seem to get it working...help please!!!!

FSt1

move cursor in excle using macro
 
hi
activecell.cut destination:=activecell.offset(2,0)
activecell.end(xldown).activate

but if the number of rows between the cut and paste is never the same, i
can't see how this will do much good other than show you the syntax.

Regards
FSt1

"fdibbins" wrote:

ok, sounds dumb, but how do I move the cursor in excel a set number of lines
using a macro - cant use a cell reference because it changes all the time. I
need to cut an item in 1 cell, move down 2 lines, past it and then "enddown"
to find the next instance. I have 100's of these to do, and number of lines
between each cut/paste is never the same. I know its really simple, but just
cant seem to get it working...help please!!!!


Don Guillett

move cursor in excle using macro
 

Post examples of before/after

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"fdibbins" wrote in message
...
ok, sounds dumb, but how do I move the cursor in excel a set number of
lines
using a macro - cant use a cell reference because it changes all the time.
I
need to cut an item in 1 cell, move down 2 lines, past it and then
"enddown"
to find the next instance. I have 100's of these to do, and number of
lines
between each cut/paste is never the same. I know its really simple, but
just
cant seem to get it working...help please!!!!



Don Guillett

move cursor in excle using macro
 
I don't like selections but try this. Change "a" to your column.

Sub cuttworowsdown()
cells(Rows.Count, "a").End(xlUp).Select
Do Until ActiveCell.Row = 1
ActiveCell.Cut ActiveCell.Offset(2)
ActiveCell.End(xlUp).Select
Loop
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"fdibbins" wrote in message
...
ok, sounds dumb, but how do I move the cursor in excel a set number of
lines
using a macro - cant use a cell reference because it changes all the time.
I
need to cut an item in 1 cell, move down 2 lines, past it and then
"enddown"
to find the next instance. I have 100's of these to do, and number of
lines
between each cut/paste is never the same. I know its really simple, but
just
cant seem to get it working...help please!!!!



fdibbins

move cursor in excle using macro
 
Thanks a bunch, works great. The cut/paste distance remains the same, just
the distance to the next "set" changes, so an .end(xldown) works well for
that too.

If i wanted to just move to a cell x lines down (or x colums across), what
part of this command would do that?

ActiveCell.Cut Destination:=ActiveCell.Offset(1, 0)
ActiveCell.End(xlDown).Activate

and thanks for the really fast reply :)

"FSt1" wrote:

hi
activecell.cut destination:=activecell.offset(2,0)
activecell.end(xldown).activate

but if the number of rows between the cut and paste is never the same, i
can't see how this will do much good other than show you the syntax.

Regards
FSt1

"fdibbins" wrote:

ok, sounds dumb, but how do I move the cursor in excel a set number of lines
using a macro - cant use a cell reference because it changes all the time. I
need to cut an item in 1 cell, move down 2 lines, past it and then "enddown"
to find the next instance. I have 100's of these to do, and number of lines
between each cut/paste is never the same. I know its really simple, but just
cant seem to get it working...help please!!!!


FSt1

move cursor in excle using macro
 
hi,
the offset part.
offset(x,y) where x = row and y = columns
postive x = rows down, negative x = rows up
postive y = columns left and negative = columns right

read up on it in vb help

Regards
FS1



"fdibbins" wrote:

Thanks a bunch, works great. The cut/paste distance remains the same, just
the distance to the next "set" changes, so an .end(xldown) works well for
that too.

If i wanted to just move to a cell x lines down (or x colums across), what
part of this command would do that?

ActiveCell.Cut Destination:=ActiveCell.Offset(1, 0)
ActiveCell.End(xlDown).Activate

and thanks for the really fast reply :)

"FSt1" wrote:

hi
activecell.cut destination:=activecell.offset(2,0)
activecell.end(xldown).activate

but if the number of rows between the cut and paste is never the same, i
can't see how this will do much good other than show you the syntax.

Regards
FSt1

"fdibbins" wrote:

ok, sounds dumb, but how do I move the cursor in excel a set number of lines
using a macro - cant use a cell reference because it changes all the time. I
need to cut an item in 1 cell, move down 2 lines, past it and then "enddown"
to find the next instance. I have 100's of these to do, and number of lines
between each cut/paste is never the same. I know its really simple, but just
cant seem to get it working...help please!!!!


fdibbins

move cursor in excle using macro
 
again, thanks very much for the speedy and helpful reply. you guys rock!

"FSt1" wrote:

hi,
the offset part.
offset(x,y) where x = row and y = columns
postive x = rows down, negative x = rows up
postive y = columns left and negative = columns right

read up on it in vb help

Regards
FS1



"fdibbins" wrote:

Thanks a bunch, works great. The cut/paste distance remains the same, just
the distance to the next "set" changes, so an .end(xldown) works well for
that too.

If i wanted to just move to a cell x lines down (or x colums across), what
part of this command would do that?

ActiveCell.Cut Destination:=ActiveCell.Offset(1, 0)
ActiveCell.End(xlDown).Activate

and thanks for the really fast reply :)

"FSt1" wrote:

hi
activecell.cut destination:=activecell.offset(2,0)
activecell.end(xldown).activate

but if the number of rows between the cut and paste is never the same, i
can't see how this will do much good other than show you the syntax.

Regards
FSt1

"fdibbins" wrote:

ok, sounds dumb, but how do I move the cursor in excel a set number of lines
using a macro - cant use a cell reference because it changes all the time. I
need to cut an item in 1 cell, move down 2 lines, past it and then "enddown"
to find the next instance. I have 100's of these to do, and number of lines
between each cut/paste is never the same. I know its really simple, but just
cant seem to get it working...help please!!!!



All times are GMT +1. The time now is 01:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com