Forum Discussion
Sonal2309
Jan 09, 2020Copper Contributor
Auto Fill Error when output data are less than 1
Hi, I have been trying to use below AutoFill code, but I am getting an error when data is less than 1. Is there a way for get away with this error: Range("E2").Select Selection.AutoFill Dest...
peanut
Jan 14, 2020Copper Contributor
Hi Sonal2309
The trouble is not with the code that you posted but in the previous line:
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC1,Sheet3,2,0)"
This line creates an error in the field D2. Then you tell Excel to fill-down the error which Excel refuses to do.
To check it yourself, while in Excel, press ALT+F11 and it will open VBA editor. Then use F8 to go line by line and watch you spreadsheet as you keep pressing F8.
I would correct your code, but I don't know how exactly your VLOOKUP works.
For start, look for VBA examples of VLOOKUP.
If you give me more details, maybe I can fix it for you.