=IF(ISERROR(VLOOKUP("B6",TEST!A:A,1,FALSE)),"NO","YES") autofill problems

lordterrin

Board Regular
Joined
Mar 21, 2012
Messages
155
Hi there,

I'm using the following formula in cell D6 of my sheet:

Code:
=IF(ISERROR(VLOOKUP("B6",TEST!A:A,1,FALSE)),"NO","YES")

which is working perfectly :cool: - - - until I execute this line in the VBA code:

Code:
Range("D6").Select
    Selection.AutoFill Destination:=Range("D6:D" & ActiveSheet.UsedRange.Rows.Count)

The purpose of this is to do a vlookup on a large range of data, and return "yes" or "no" against all 5000 cells. Now - the autofill "works" in the fact that it copies cell D6 down to whatever the last row is in my sheet, but the problem is that when I select D6 and autofill down, it doesn't change the formula to B6, B7, B8, etc as it goes down the sheet., like a vlookup normally does when you fill down.

In effect, each of the 5,000 cells in the sheet all have the exact same formula in them - all referencing cell B6 on the sheet Test

What am I doing wrong?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
Well I'm dumb - I don't know how quotes got in there.... I removed the quotes around "B6" to make it B6, then it worked fine in the autofill. :)

I'll leave this here in case anyone else has this same silly problem! :)
 
Upvote 0

Forum statistics

Threads
1,206,833
Messages
6,075,126
Members
446,123
Latest member
junkyardforme

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