Excel formula to VBA code

PaulCL

New Member
Joined
Jul 9, 2014
Messages
43
Hello Folks,
Can anyone convert this excel formula to VBA.

=IF(ISNA(VLOOKUP(A2,'Original BHHS List'!$A$1:$A$84,1,FALSE)), "Not Duplicate", "Duplicate")

Tks
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
This will put the formula into cell A1 of the active sheet (change to suit):

Code:
Option Explicit
Sub Macro1()

    Range("A1").Formula = "=IF(ISNA(VLOOKUP(A2,'Original BHHS List'!$A$1:$A$84,1,FALSE)), ""Not Duplicate"", ""Duplicate"")"

End Sub

Regards,

Robert
 
Upvote 0
Range("B2").Formula = "=IF(ISNA(VLOOKUP(A2,'Original BHHS Error List'!$A$1:$A$84,1,FALSE)), ""New Error"", ""Duplicate Error"")"

What would be the code to have the result of the formula in "B2" filldown as far as there is data in column A
Tks
 
Upvote 0
Try this:

Code:
Range("B2:B" & Cells(Rows.Count, "A").End(xlUp).Row).Formula = "=IF(ISNA(VLOOKUP(A2,'Original BHHS Error List'!$A$1:$A$84,1,FALSE)), ""New Error"", ""Duplicate Error"")"

Robert
 
Upvote 0

Forum statistics

Threads
1,215,679
Messages
6,126,177
Members
449,296
Latest member
tinneytwin

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