Copy Problem
try this code. I assumed that column A on Summary sheet has data in each
row. needed to find the last row of the summary sheet and made an assuption
that Column A has data in it for every row.
Sub AddToSummary()
Const InvoiceSh = "Invoice"
Const SummarySh = "Summary"
Sheets(InvoiceSh).Activate
InvLastrow = Sheets(InvoiceSh).Cells(Rows.Count, 1).End(xlUp).Row
Sheets(SummarySh).Activate
SumLastRow = Sheets(SummarySh).Cells(Rows.Count, 1).End(xlUp)
'move to 1st blank line
SumLastRow = SumLastRow + 1
For InvRowCount = 1 To InvLastrow
'check for empty rows
Sheets(InvoiceSh).Activate
InvLastcolumn = Sheets(InvoiceSh).Cells(InvRowCount,
Columns.Count).End(xlToLeft).Column
If (InvLastcolumn 1) Or Not
IsEmpty(Sheets(InvoiceSh).Cells(InvRowCount, 1)) Then
Sheets(InvoiceSh).Cells(InvRowCount, 1).EntireRow.Copy _
Destination:=Sheets(SummarySh).Cells(SumLastRow, 1)
SumLastRow = SumLastRow + 1
End If
Next InvRowCount
End Sub
"WTG" wrote:
Sorry to bother you guys again.
But I'm stuck, and you where all such a great help last time.
I have an invoice sheet and a Product Summary sheet.
I want to take the rows from my Invoice sheet and add them to my
summary sheet.
My invoice sheet has 27 rows, but only some of the rows will actually
have items in them. When I click on a cmd button I want to take the
rows that have items in them and add the information to the bottom of
my summary list.
I've tried macros, and using a dynamic name range.. but I can't get it
to work :(
Can anyone help me with this?
Thanks
Wally
|