Copy and fill cell contents to first empty cell and autofill to last row of adjacent column

Wedne5day1te

New Member
Joined
Aug 5, 2018
Messages
7
I have a large spreadsheet with different columns with varyingnumbers of product item rows below each SKU heading. I have a routine whichcopies the product range and dumps this into column B in Sheets("Dump").This works ok.

Set ActSheet = ActiveSheet
ActSheet.Range("A" & Product &":" & "A" & LastRowColA).Copy
With Sheets("Dump")
.Range("B" & .Rows.Count).End(xlUp).Offset(1).PasteSpecialPaste:=xlPasteValues, Operation:=xlNone, SkipBlanks _ :=False, Transpose:=False
End With
I then want to copy the SKU code which is the value in "SKURange"to the Dump worksheet column A into the first blank row in column A and autofillto the last row determined by the last row in the adjacent column B.
Thanks for your help
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
OKAY
See next code
The Const are just there to make it working in my file
Code:
Option Explicit
Sub Test()
Const LastRowColA = 20
Const Product = 2
Dim ActSheet As Worksheet
Dim FR  As Integer, LR As Integer
    Set ActSheet = ActiveSheet
    ActSheet.Range("A" & Product & ":" & "A" & LastRowColA).Copy
    With Sheets("Dump")
        .Range("B" & .Rows.Count).End(xlUp).Offset(1).PasteSpecial Paste:=xlPasteValues, _
         Operation:=xlNone, SkipBlanks:=False, Transpose:=False
         FR = .Range("A1").End(xlDown).Row
         LR = .Range("B" & Rows.Count).End(3).Row
         With Range(.Cells(FR + 1, "A"), .Cells(LR, "A"))
            .Cells(1, 1) = Range("SKURange")
            .FillDown
         End With
    End With
End Sub
 
Last edited:
Upvote 0
Merci toi aussi
Thank you you to
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,182
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top