copying specified data from one worksheet to another

DazedConfuzed

New Member
Joined
Aug 4, 2011
Messages
1
Hi,

I'm hoping someone can help. I have created a workbook with two sheets. A sheet named "Invoice" and another named "Sales Summary Sheet" (SSS).

After clicking on a button (on the Invoice sheet), data in specific cells get copied to specific cells in SSS.

I want to copy row(s) depending on how many rows are entered into the Invoice template, to the SSS sheet. Currently rows A19:H19, A20:H20, A21:H21...to A32:H32 are rows that can have potential data in it that need to be copied to rows in the SSS sheet.

For every row in the Invoice sheet, I need to copy the data to a new row in the SSS sheet (and not overwrite existing rows of data in the SSS sheet). So for example row A19:A32 need to be copied to A2:O2, and if data in B19:B32 exists , then it also needs to be copied to A3:O3.

Once SSS is saved, the next time I open Invoice and re-enter data into A19:A32, it will add the data into SSS in cells A4:O4.

Right now I have this current code:

Code:
Private Sub CopyToSheet_Click()
Dim LastRow As Object
Set LastRow = Sheet1.Range("A19:H32").End(xlUp)

'Range("A19:H32").Copy Destination:=Sheets("Sheet1").
'Adds the data to Sales Summary Sheet
'Sheet1 is the (Name) of the sheet, i.e. the object
'NOT the name in the tab of the sheet
LastRow.Offset(1, 0).Value = Sheet4.Range("H8").Value
LastRow.Offset(1, 1).Value = Sheet4.Range("H7").Value
LastRow.Offset(1, 2).Value = Sheet4.Range("B19:B32").Value
LastRow.Offset(1, 3).Value = Sheet4.Range("A19:A32").Value
LastRow.Offset(1, 4).Value = Sheet4.Range("A6").Value
LastRow.Offset(1, 5).Value = Sheet4.Range("F19:F32").Value
LastRow.Offset(1, 6).Value = Sheet4.Range("H19:H32").Value
LastRow.Offset(1, 7).Value = Sheet4.Range("H12").Value
End Sub
When I run the above code, it only copies row A19:H19 in the Invoice sheet to
row A2:O2 in SSS, and DOES NOT copy the second (third, fourth...) row of data to
SSS.


Any help would be GREATLY Appreciated!

APPRECIATED!

Thanks
 
Last edited:

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.

Forum statistics

Threads
1,224,537
Messages
6,179,405
Members
452,911
Latest member
a_barila

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top