Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Sub Submit1()
- Range("A2:C2").Select #in Sheet1
- Selection.Copy
- Sheets("Sheet2").Select
- Worksheets("Sheet2").Cells(Rows.Count, "A").End(xlUp).Offset(1, 0).PasteSpecial
- End Submit1
- Sub Submit1()
- Dim nextRow As Long
- With Worksheets("Sheet2")
- 'Find the last non-empty cell in the worksheet, and determine its row
- 'Then add 1 to that, so we are pointing at the next row
- nextRow = .Cells.Find(What:="*", _
- After:=.Range("A1"), _
- Lookat:=xlPart, _
- LookIn:=xlFormulas, _
- SearchOrder:=xlByRows, _
- SearchDirection:=xlPrevious, _
- MatchCase:=False).Row + 1
- 'Copy values to "nextRow"
- Worksheets("Sheet1").Range("A2:C2").Copy .Cells(nextRow, "A")
- 'Perform other copies as necessary, e.g.
- Worksheets("Sheet1").Range("A5:D5").Copy .Cells(nextRow, "D")
- Worksheets("Sheet1").Range("X4:Z4").Copy .Cells(nextRow, "H")
- End With
- End Sub
- Sub test()
- Dim LastRow As Long Dim arCopy() As Variant
- Dim rDest As Range
- With Sheet2 ' --> Qualify the ranges
- LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1 End With
- arCopy = Sheet1.Range("A2:K2").Value
- Set rDest = Sheet2.Cells(LastRow, "A")
- Set rDest = rDest.Resize(1, UBound(arCopy, 2))
- rDest.Value = arCopy
- End Sub
- Sheet1.Range("A1")="Rob"
- Sheet1.Copy("A2")
- Sheet1.Rows.Count
- With Sheet1
- .Range("A1") = "Rob"
- .Copy("A2")
- .Rows.Count
- End With
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement