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:
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
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
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: