Not_Really_Me
New Member
- Joined
- May 29, 2020
- Messages
- 5
- Office Version
- 2016
- Platform
- Windows
Hi all,
I'm trying to copy data from the data entry worksheet (Sheet1) to a second, data record worksheet (Sheet2), but I'm not that strong of a programmer so I've mostly been cobbling together different examples. The code below works well, except that I need the content in column I to be pasted at the end but it is always pasted between G and M.
Private Sub CommandButton1_Click()
lastRow = Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
For r = 4 To lastRow
If Worksheets("Sheet1").Range("A" & r).Value <> "" Then
Worksheets("Sheet1").Range("A" & r & ":G" & r & ",M" & r & ":S" & r & ",I" & r).Copy
Worksheets("Sheet2").Activate
lastRowRpt = Worksheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row
Worksheets("Sheet2").Range("A" & lastRowRpt + 1).Select
ActiveSheet.Paste
End If
Next r
End Sub
There are also several areas where I need to jump back and forth in the order in which column content is pasted over (e.g., A:M, I, O:AO, N, etc.) Is it possible to do this?
Thanks!
I'm trying to copy data from the data entry worksheet (Sheet1) to a second, data record worksheet (Sheet2), but I'm not that strong of a programmer so I've mostly been cobbling together different examples. The code below works well, except that I need the content in column I to be pasted at the end but it is always pasted between G and M.
Private Sub CommandButton1_Click()
lastRow = Worksheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
For r = 4 To lastRow
If Worksheets("Sheet1").Range("A" & r).Value <> "" Then
Worksheets("Sheet1").Range("A" & r & ":G" & r & ",M" & r & ":S" & r & ",I" & r).Copy
Worksheets("Sheet2").Activate
lastRowRpt = Worksheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Row
Worksheets("Sheet2").Range("A" & lastRowRpt + 1).Select
ActiveSheet.Paste
End If
Next r
End Sub
There are also several areas where I need to jump back and forth in the order in which column content is pasted over (e.g., A:M, I, O:AO, N, etc.) Is it possible to do this?
Thanks!