ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Selecting An Entire Row. (https://www.excelbanter.com/excel-programming/352950-selecting-entire-row.html)

Sam

Selecting An Entire Row.
 
Hi,

My simple macro is supposed cut a line from Sheet 1 and paste it to the
first available Row in Sheet 2, and then delete the original line from Sheet
1. It would work, I think, if I could get past the first line. The first
line is:

Worksheets(1).ActiveCell.EntireRow.Select

I get message:

Run-time error `438':
Object doesn't support this property or method.

(My plan is to have user activate this macro with a hot key, like Ctrl +
R., as he is scrolling through sheet and finds a line that should be moved.)

What should the syntax be to select the row where the cursor is??

Thank you,

Sam



Jim Thomlinson[_5_]

Selecting An Entire Row.
 
I think you want to drop the first part of that line of code. this should be
close to what you want...

with activecell.entirerow
.copy sheets("Sheet2").cells(rows.count, "A").end(xlUp).offset(1,0)
.delete
end with

--
HTH...

Jim Thomlinson


"Sam" wrote:

Hi,

My simple macro is supposed cut a line from Sheet 1 and paste it to the
first available Row in Sheet 2, and then delete the original line from Sheet
1. It would work, I think, if I could get past the first line. The first
line is:

Worksheets(1).ActiveCell.EntireRow.Select

I get message:

Run-time error `438':
Object doesn't support this property or method.

(My plan is to have user activate this macro with a hot key, like Ctrl +
R., as he is scrolling through sheet and finds a line that should be moved.)

What should the syntax be to select the row where the cursor is??

Thank you,

Sam




Sam

Selecting An Entire Row.
 
I think you want to drop the first part of that line of code. this should
be
close to what you want...

with activecell.entirerow
.copy sheets("Sheet2").cells(rows.count, "A").end(xlUp).offset(1,0)
.delete
end with

Jim Thomlinson


Yes, that works.
Thank you.



"Sam" wrote:

Hi,

My simple macro is supposed cut a line from Sheet 1 and paste it to
the
first available Row in Sheet 2, and then delete the original line from
Sheet
1. It would work, I think, if I could get past the first line. The first
line is:

Worksheets(1).ActiveCell.EntireRow.Select

I get message:

Run-time error `438':
Object doesn't support this property or method.

(My plan is to have user activate this macro with a hot key, like Ctrl
+
R., as he is scrolling through sheet and finds a line that should be
moved.)

What should the syntax be to select the row where the cursor is??

Thank you,

Sam







All times are GMT +1. The time now is 12:14 PM.

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