ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Trying to creat a Macro to count rows and more (https://www.excelbanter.com/excel-programming/371762-trying-creat-macro-count-rows-more.html)

jln

Trying to creat a Macro to count rows and more
 
Um trying to create a macro that counts all the rows on one sheet in say 5
rows abcde then go to the last record before a null or blank cell then takes
thoses five records and copys and paste them over to another worksheet. I
then want the Macro to go to another worksheet and do the same as above but
it needs to paste thoses records onto the same worksheet as above but below
the already pasted records. The number of lines could change as well that
will need to be pasted.


Tom Ogilvy

Trying to creat a Macro to count rows and more
 
Dim sh as Worksheet
for each sh in worksheets(Array(1,3,5,8,9))
sh.Range("A1").currentregion.copy _
worksheets(4).Cells(rows.count,1).End(xlup)(2)
Next

--
Regards,
Tom Ogilvy


"jln" wrote:

Um trying to create a macro that counts all the rows on one sheet in say 5
rows abcde then go to the last record before a null or blank cell then takes
thoses five records and copys and paste them over to another worksheet. I
then want the Macro to go to another worksheet and do the same as above but
it needs to paste thoses records onto the same worksheet as above but below
the already pasted records. The number of lines could change as well that
will need to be pasted.



jln

Trying to creat a Macro to count rows and more
 
I think this is close but I not sure about the array im only going to be
going from on sheet then copy then going to another sheet and copy.

Tom Ogilvy wrote:
Dim sh as Worksheet
for each sh in worksheets(Array(1,3,5,8,9))
sh.Range("A1").currentregion.copy _
worksheets(4).Cells(rows.count,1).End(xlup)(2)
Next

Um trying to create a macro that counts all the rows on one sheet in say 5
rows abcde then go to the last record before a null or blank cell then takes

[quoted text clipped - 3 lines]
the already pasted records. The number of lines could change as well that
will need to be pasted.



Tom Ogilvy

Trying to creat a Macro to count rows and more
 
that is what it is doing

if we had this:

for each sh in worksheets(Array(1,3))

It would go to the first sheet in the tab order and copy

paste to sheet 4 in the tab order at the top
then it would go to the third sheet in the tab order and copy
paste to sheet 4 in the tab order below the first. Assumes that the first
column that was pasted will not have blank cells at the bottom

--
Regards,
Tom Ogilvy


"jln" <u25956@uwe wrote in message news:658c0d5600c4f@uwe...
I think this is close but I not sure about the array im only going to be
going from on sheet then copy then going to another sheet and copy.

Tom Ogilvy wrote:
Dim sh as Worksheet
for each sh in worksheets(Array(1,3,5,8,9))
sh.Range("A1").currentregion.copy _
worksheets(4).Cells(rows.count,1).End(xlup)(2)
Next

Um trying to create a macro that counts all the rows on one sheet in
say 5
rows abcde then go to the last record before a null or blank cell then
takes

[quoted text clipped - 3 lines]
the already pasted records. The number of lines could change as well
that
will need to be pasted.





jln via OfficeKB.com

Trying to creat a Macro to count rows and more
 
Thanks for Your Help Tom

I tried your code with my worksheet names and im not having any luck. All I
should have to do to make this work with names is replace the numbers right?
I get and expected seprator or ) when i change to the names im using for my
tabs.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200609/1



All times are GMT +1. The time now is 07:25 AM.

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