ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Take Action Based Upon # of Rows in Another Worksheet (https://www.excelbanter.com/excel-programming/371030-take-action-based-upon-rows-another-worksheet.html)

Paige

Take Action Based Upon # of Rows in Another Worksheet
 
Have been trying to figure out how to do this. I have 2 worksheets, A and B.
Need to copy row 3 on worksheet B and paste it down as many rows as there
are on worksheet A. Example, if the last row of data on A is in row 4500,
then I need to copy Row 3 on B and paste it from row 4 through 4500 of
worksheet B. The # of rows on A will change each time. I know how to do all
the copy/paste stuff, but am stuck on how to direct VB on how many rows to
paste down. Would appreciate help very much on this.....thanks.

Don Guillett

Take Action Based Upon # of Rows in Another Worksheet
 
this should help

lastrow = Sheets("sheet3").Cells(Rows.Count, "a").End(xlUp).Row
MsgBox lastrow

--
Don Guillett
SalesAid Software

"Paige" wrote in message
...
Have been trying to figure out how to do this. I have 2 worksheets, A and
B.
Need to copy row 3 on worksheet B and paste it down as many rows as there
are on worksheet A. Example, if the last row of data on A is in row 4500,
then I need to copy Row 3 on B and paste it from row 4 through 4500 of
worksheet B. The # of rows on A will change each time. I know how to do
all
the copy/paste stuff, but am stuck on how to direct VB on how many rows to
paste down. Would appreciate help very much on this.....thanks.




Tom Ogilvy

Take Action Based Upon # of Rows in Another Worksheet
 
lastrow = Worksheets("A").Cells(rows.count,1).End(xlup).row
worksheets("B").Rows(3).copy Destination:= _
Worksheets("A").Range("A4").Resize(lastrow-3).EntireRow

--
Regards,
Tom Ogilvy


"Paige" wrote:

Have been trying to figure out how to do this. I have 2 worksheets, A and B.
Need to copy row 3 on worksheet B and paste it down as many rows as there
are on worksheet A. Example, if the last row of data on A is in row 4500,
then I need to copy Row 3 on B and paste it from row 4 through 4500 of
worksheet B. The # of rows on A will change each time. I know how to do all
the copy/paste stuff, but am stuck on how to direct VB on how many rows to
paste down. Would appreciate help very much on this.....thanks.


Paige

Take Action Based Upon # of Rows in Another Worksheet
 
Thanks Don and Tom; they both work great!

"Tom Ogilvy" wrote:

lastrow = Worksheets("A").Cells(rows.count,1).End(xlup).row
worksheets("B").Rows(3).copy Destination:= _
Worksheets("A").Range("A4").Resize(lastrow-3).EntireRow

--
Regards,
Tom Ogilvy


"Paige" wrote:

Have been trying to figure out how to do this. I have 2 worksheets, A and B.
Need to copy row 3 on worksheet B and paste it down as many rows as there
are on worksheet A. Example, if the last row of data on A is in row 4500,
then I need to copy Row 3 on B and paste it from row 4 through 4500 of
worksheet B. The # of rows on A will change each time. I know how to do all
the copy/paste stuff, but am stuck on how to direct VB on how many rows to
paste down. Would appreciate help very much on this.....thanks.



All times are GMT +1. The time now is 01:45 PM.

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