#1   Report Post  
Posted to microsoft.public.excel.misc
WTG WTG is offline
external usenet poster
 
Posts: 11
Default Copy Problem

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
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.misc
WTG WTG is offline
external usenet poster
 
Posts: 11
Default Copy Problem


Thanks Joel,

I tried it, but I kept coming up with debug errors. and I don't know
much about what I was doing. :(

I have been searching and Came up with this,

Private Sub CommandButton1_Click()
LastRow = Sheets("Invoice").Range("A65536").End(xlUp).Row + 1
Range("A6:H32").Select
Selection.Copy
Sheets("Summary").Select
Range("LastRow").Select
ActiveSheet.Paste

End Sub

But this gives me debug errors to :(


On Wed, 21 Mar 2007 17:13:14 -0700, Joel
wrote:

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

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9,101
Default Copy Problem

WTG: there appears to have been some lines that were too long and created the
errors. I add continuation character (_ underscore) to get rid of those
errors. I also replaced the CommandButton1_Click() with my code try the code
below


Private Sub CommandButton1_Click()
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:


Thanks Joel,

I tried it, but I kept coming up with debug errors. and I don't know
much about what I was doing. :(

I have been searching and Came up with this,

Private Sub CommandButton1_Click()
LastRow = Sheets("Invoice").Range("A65536").End(xlUp).Row + 1
Range("A6:H32").Select
Selection.Copy
Sheets("Summary").Select
Range("LastRow").Select
ActiveSheet.Paste

End Sub

But this gives me debug errors to :(


On Wed, 21 Mar 2007 17:13:14 -0700, Joel
wrote:

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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy/Paste Problem Seti Excel Worksheet Functions 0 August 31st 06 05:10 PM
Copy and Paste Problem Skc Excel Discussion (Misc queries) 1 March 8th 06 07:21 PM
macro copy problem JE McGimpsey Excel Discussion (Misc queries) 1 February 13th 06 08:03 AM
copy paste problem? Neil22 Excel Discussion (Misc queries) 5 January 10th 06 05:32 PM
Copy Problem [email protected] Excel Discussion (Misc queries) 6 August 11th 05 12:45 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"