#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
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.worksheet.functions
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

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 35,218
Default copy problem

How about:

Private Sub CommandButton1_Click()
LastRow = Sheets("Invoice").Range("A65536").End(xlUp).Row + 1
me.Range("A6:H32").Copy _
destination:=sheets("invoice").cells(lastrow,"A")
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


--

Dave Peterson
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 Problem WTG Excel Discussion (Misc queries) 3 March 23rd 07 10:14 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 03:33 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"