erutherford
Active Member
- Joined
- Dec 19, 2016
- Messages
- 449
Spent hours combing through for samples, but coming up empty
Worksheet 1 is where I fill out work orders. Worksheet 2 is a cumulative history of each of the work orders from worksheet 1.
I figured if I could get one line working properly, then adding additional line would be easy (that is why you see additional lines "noted").
"last row" seems to be where I am having issues
Below is a sample of the code I have been working with.
Private Sub CommandButton2_Click()
'Sub Paste_My_Data()
Dim LastrowA As String
'Dim LastrowB As String
'Dim LastrowC As String
'Dim LastrowD As String
'Below IDs where next blank cell is
LastrowA = Sheets("sheet2").Cells(Rows.Count, "A").End(xlUp).Row + 1
'LastrowB = Sheets("sheet2").Cells(Rows.Count, "B").End(xlUp).Row + 1
'LastrowC = Sheets("sheet2").Cells(Rows.Count, "C").End(xlUp).Row + 1
'LastrowD = Sheets("sheet2").Cells(Rows.Count, "D").End(xlUp).Row + 1
'Below is actual assigning of data
Sheets("sheet2").Range("A2:A7" & LastrowA).Value = Sheets("sheet1").Range("A2:A7").Value
'Sheets("sheet2").Range("B2:B7" & Lastrow).Value = Sheets("sheet1").Range("B2:B10").Value
'Sheets("sheet2").Range("C2:C7" & LastrowC).Value = Sheets("sheet1").Range("C2:C10").Value
'Sheets("sheet2").Range("D2:D7" & LastrowD).Value = Sheets("sheet1").Range("D2").Value
'Sheets("sheet1").Range("A2:A10").ClearContents
'Sheets("sheet1").Range("B2:B10").ClearContents
'Sheets("sheet1").Range("C2:C10").ClearContents
'Sheets("sheet1").Range("D2:D10").ClearContents
'MsgBox "Your entry has updated"
End Sub
Worksheet 1 is where I fill out work orders. Worksheet 2 is a cumulative history of each of the work orders from worksheet 1.
I figured if I could get one line working properly, then adding additional line would be easy (that is why you see additional lines "noted").
"last row" seems to be where I am having issues
Below is a sample of the code I have been working with.
Private Sub CommandButton2_Click()
'Sub Paste_My_Data()
Dim LastrowA As String
'Dim LastrowB As String
'Dim LastrowC As String
'Dim LastrowD As String
'Below IDs where next blank cell is
LastrowA = Sheets("sheet2").Cells(Rows.Count, "A").End(xlUp).Row + 1
'LastrowB = Sheets("sheet2").Cells(Rows.Count, "B").End(xlUp).Row + 1
'LastrowC = Sheets("sheet2").Cells(Rows.Count, "C").End(xlUp).Row + 1
'LastrowD = Sheets("sheet2").Cells(Rows.Count, "D").End(xlUp).Row + 1
'Below is actual assigning of data
Sheets("sheet2").Range("A2:A7" & LastrowA).Value = Sheets("sheet1").Range("A2:A7").Value
'Sheets("sheet2").Range("B2:B7" & Lastrow).Value = Sheets("sheet1").Range("B2:B10").Value
'Sheets("sheet2").Range("C2:C7" & LastrowC).Value = Sheets("sheet1").Range("C2:C10").Value
'Sheets("sheet2").Range("D2:D7" & LastrowD).Value = Sheets("sheet1").Range("D2").Value
'Sheets("sheet1").Range("A2:A10").ClearContents
'Sheets("sheet1").Range("B2:B10").ClearContents
'Sheets("sheet1").Range("C2:C10").ClearContents
'Sheets("sheet1").Range("D2:D10").ClearContents
'MsgBox "Your entry has updated"
End Sub