WildBurrow
New Member
- Joined
- Apr 5, 2021
- Messages
- 41
- Office Version
- 365
- Platform
- Windows
I'm having extreme difficulty figuring out how to resize (I think that is the term I'm looking for) and offset pasted information.
I'm using column ("A") from the source sheet ("Summary") to match tab names in the workbook. I found code (see below) that will copy and paste accordingly; however, I need to accomplish the following:
1) Only copy columns ("B:G") from source sheet ("Summary"); this means omitting data in column ("A").
2) Paste the data into columns ("J:O"), second row on the destination sheet.
Can anyone help me address this?
I'm using column ("A") from the source sheet ("Summary") to match tab names in the workbook. I found code (see below) that will copy and paste accordingly; however, I need to accomplish the following:
1) Only copy columns ("B:G") from source sheet ("Summary"); this means omitting data in column ("A").
2) Paste the data into columns ("J:O"), second row on the destination sheet.
Can anyone help me address this?
VBA Code:
Sub IncToCntySheet()
Application.ScreenUpdating = False
Dim rs As Worksheet
Set rs = Worksheets("Summary")
For r = 1 To rs.Range("A" & Rows.Count).End(xlUp).Row
wsName = rs.Cells(r, "A")
If WorksheetFunction.IsErr(Evaluate("'" & wsName & "'!A1")) = "False" Then
wr = Worksheets(wsName).Range("A" & Rows.Count).End(xlUp).Row + 1
rs.Rows(r).Copy Destination:=Worksheets(wsName).Range("A" & wr)
End If
Next r
MsgBox "Incident List Copied to Sheet"
Application.ScreenUpdating = True
End Sub
'SOURCE: https://www.mrexcel.com/board/threads/copy-rows-based-on-cell-value-to-match-with-tab-name.1167970/