ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   User select row? (https://www.excelbanter.com/excel-programming/339602-user-select-row.html)

rudini

User select row?
 
Hello all,

I want to make a really simple macro:

Rows("42:42").Select 'This line is where the problem lies.
Selection.Copy
Rows("2:2").Select
ActiveSheet.Paste


Looks easy enough, right? I want to copy one line and paste it somewhere else.

The first line though, I'd like to make it user dependent. So if the user
click on row 42 or row 52 or 102 it doesn't matter.

please help!
rudini

Chip Pearson

User select row?
 
If I understand your question, just omit the line
Rows("42:42").Select


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"rudini" wrote in message
...
Hello all,

I want to make a really simple macro:

Rows("42:42").Select 'This line is where the problem
lies.
Selection.Copy
Rows("2:2").Select
ActiveSheet.Paste


Looks easy enough, right? I want to copy one line and paste it
somewhere else.

The first line though, I'd like to make it user dependent. So
if the user
click on row 42 or row 52 or 102 it doesn't matter.

please help!
rudini




Tom Ogilvy

User select row?
 
ActiveCell.EntireRow.copy Rows("2:2")

Should do it.

--
Regards,
Tom Ogilvy


"rudini" wrote in message
...
Hello all,

I want to make a really simple macro:

Rows("42:42").Select 'This line is where the problem lies.
Selection.Copy
Rows("2:2").Select
ActiveSheet.Paste


Looks easy enough, right? I want to copy one line and paste it somewhere

else.

The first line though, I'd like to make it user dependent. So if the user
click on row 42 or row 52 or 102 it doesn't matter.

please help!
rudini




rudini

User select row?
 
holy smokes!

Thanks Tom, for my purposes i used:

ActiveCell.EntireRow.copy
Selection.Copy
Rows("2:2").Select
ActiveSheet.Paste

That enables me to select any row (the left hand most column with the
numbers) and hit crtl+d, and bam! it does exactly what i need! thank you guys!


"Tom Ogilvy" wrote:

ActiveCell.EntireRow.copy Rows("2:2")

Should do it.

--
Regards,
Tom Ogilvy


"rudini" wrote in message
...
Hello all,

I want to make a really simple macro:

Rows("42:42").Select 'This line is where the problem lies.
Selection.Copy
Rows("2:2").Select
ActiveSheet.Paste


Looks easy enough, right? I want to copy one line and paste it somewhere

else.

The first line though, I'd like to make it user dependent. So if the user
click on row 42 or row 52 or 102 it doesn't matter.

please help!
rudini






All times are GMT +1. The time now is 10:41 AM.

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