Excel Autofill Formula Down to Adjacent Column

MtyAVATAR

New Member
Joined
Jul 16, 2015
Messages
7
To start off, I have found this answer on several different forums, all the answers are the same, but I cannot get it to work.

I have a set of data from column A through column T with the number of rows varying based on report ran. I need to paste a formula in U2 and have it paste all the way down to the last row of data in column T. Column T never has blanks in it so the formula should work. What am I doing wrong?

Sheets("Data Dump").Select
Range("U2").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-18],'2016 Claimed Cost Centers'!C[-20],1,FALSE)),""N"",""Y"")"
Range("U2").Select
Selection.AutoFill Destination:=Range("U2:U" & Cells(Rows.Count, "T").End(x1Up).Row) '''Here is where it errors out
Columns("U:U").Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
It should be xlUp not x1Up.
Code:
With Sheets("Data Dump")
    .Range("U2").FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-18],'2016 Claimed Cost Centers'!C[-20],1,FALSE)),""N"",""Y"")"
    .Range("U2").AutoFill Destination:=Range("U2:U" & .Cells(Rows.Count, "T").End(xlUp).Row) 
    .Columns("U:U").Copy
    .Columns("U:U").PasteSpecial Paste:=xlPasteValues
End With
 
Upvote 0
Okay so I changed the "1" to a "l" and reran the macro and it inputs the formula at U1 but nowhere else.

[TABLE="width: 178"]
<tbody>[TR]
[TD]User Name [/TD]
[TD]D/C[/TD]
[TD]N[/TD]
[/TR]
[TR]
[TD]ZZ90PH[/TD]
[TD]C[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]TZKT02[/TD]
[TD]C[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]U1106267[/TD]
[TD]D[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]ZZ90PH[/TD]
[TD]C[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]TZKT02[/TD]
[TD]C[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]TZKT02[/TD]
[TD]C[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]U1106523[/TD]
[TD]C[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]U1106523[/TD]
[TD]C[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]U1106523[/TD]
[TD]D[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]U1106523[/TD]
[TD]C[/TD]
[TD][/TD]
[/TR]
</tbody><colgroup><col><col><col></colgroup>[/TABLE]

here is my full code:

Sub FAR_31_2016()

Sheets("Data Dump").Select

ActiveCell.FormulaR1C1 = _
"=IF(ISNA(VLOOKUP(RC[-18],'2016 Claimed Cost Centers'!C[-20],1,FALSE)),""N"",""Y"")"

Range("U2").Select

Selection.AutoFill Destination:=Range("U2:U" & Cells(Rows.Count, "T").End(xlUp).Row)

Columns("U:U").Select

Selection.Copy

Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

End Sub
 
Upvote 0
My apologies. I pasted the code and it worked perfectly and I see what I did wrong. Thank you. Much appreciated!
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,021
Members
452,374
Latest member
keccles

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