ExcelPupper
Board Regular
- Joined
- Mar 2, 2020
- Messages
- 112
- Office Version
- 2019
- Platform
- Windows
Hi I just want to confirm what's wrong on the code below particularly in the Filldown portion? It won't run properly when I tried it earlier.
Just to add, I am trying to copy the formula on Sheet1.Range (B2:E2) until the last row with data using column A of Sheet1 as reference.
Thanks!
Just to add, I am trying to copy the formula on Sheet1.Range (B2:E2) until the last row with data using column A of Sheet1 as reference.
Thanks!
VBA Code:
Sub CopyData()
Dim lr As Long, lr2 As Long
lr = Sheets(3).Range("B" & Rows.Count).End(xlUp).Row
lr2 = Sheets(1).Range("A" & Rows.Count).End(xlUp).Row
Sheets(3).Range("B2:B" & lr).Copy
Sheets(1).Range("A2").PasteSpecial Paste:=xlPasteValues
Sheets(1).Range("A:A").RemoveDuplicates Columns:=1, Header:=xlNo
Sheets(1).Range("B2:E" & lr2).FillDown
End Sub