I have reviewed several similar topics and there is something I am definitely doing wrong. I have a worksheet called "ShipDtls" that contains data. I want the last row, columns 16 thru 20, data split (see link w/example:
) {link: https://drive.google.com/file/d/0B7NhvPKqAJyIbUVtdFZnUmlGMHM/view?usp=sharing} and
I want to paste the data in those columns to the destination sheet called "Form" but I want it to paste starting in row 22 (see link w/example:
) {link: https://drive.google.com/file/d/0B7NhvPKqAJyIWHdJdUdLemlnaUU/view?usp=sharing}
I tried "hijacking" the following code but it's not working, keep getting 1004 error code:
Anyone's assistance to point me in the right direction will be GREATLY appreciated.
I want to paste the data in those columns to the destination sheet called "Form" but I want it to paste starting in row 22 (see link w/example:
I tried "hijacking" the following code but it's not working, keep getting 1004 error code:
Code:
Private Sub Paste2FRM()
Dim w1 As Worksheet, wR As Worksheet
Dim lr As Long, r As Long, Sp, n As Long
Application.ScreenUpdating = False
Set w1 = Worksheets("ShipDtls")
Set wR = Worksheets("Form")
wR.UsedRange.Clear
w1.UsedRange.Copy wR.Range("Q3")
lr = wR.Cells(Rows.Count, 1).End(xlUp).Row
For r = lr To 1 Step -1
If InStr(wR.Cells(r, 17), ",") > 0 Then
Sp = Split(wR.Cells(r, 17), ",")
wR.Rows(r + 21).Resize(UBound(Sp)).Insert
wR.Cells(r, 21).Resize(UBound(Sp) + 1) = Application.Transpose(Sp)
wR.Cells(r, 1).Resize(UBound(Sp) + 1) = wR.Cells(r, 1)
End If
Next r
wR.UsedRange.Columns.AutoFit
wR.Activate
Application.ScreenUpdating = True
End Sub
Anyone's assistance to point me in the right direction will be GREATLY appreciated.
Last edited: