Try this...
Code:Range("J1:J" & LastRow).Formula = "=IFERROR(VLOOKUP(D1,A:B,2,0),"""")"
This is a discussion on Create a vba formula from cells within the Excel Questions forums, part of the Question Forums category; Need a little assistance with a vba formula to get info from cells to create a formula like this Code: ...
Need a little assistance with a vba formula to get info from cells to create a formula like thisI am constantly adding to the formula.Code:Range("J1").Formula = "=IF(D1=""Mayberry R.F.D."",""Mayberry RFD""," & _ "IF(D1=""Diners, Drive-ins and Dives"",""Diners Drive-Ins and Dives"",IF(D1=""Forever "",""Forever (2014)""," & _ "IF(D1=""Food Factory (CA)"",""Food Factory CA"",IF(D1=""Castle (2009)"",""Castle 2009"",IF(D1=""Guy's Grocery Games"",""Guys Grocery Games"",D1))))))" Range("J1").Copy Range("J2:J" & LastRow).Select ActiveSheet.Paste Application.CutCopyMode = False
So, say column A would be what to look for, column B what to change to to.
Thanks
Try this...
Code:Range("J1:J" & LastRow).Formula = "=IFERROR(VLOOKUP(D1,A:B,2,0),"""")"
Last edited by AlphaFrog; May 26th, 2015 at 02:06 PM. Reason: Corrected quotes in formula
Paste your Excel data to the forum...
MrExcel HTML Maker or Excel Jeanie
How to post your vba code
[CODE]your VBA code here[/CODE]
The # button in the forum's editor will apply CODE tags around your selected text.
Paste your Excel data to the forum...
MrExcel HTML Maker or Excel Jeanie
How to post your vba code
[CODE]your VBA code here[/CODE]
The # button in the forum's editor will apply CODE tags around your selected text.
Paste your Excel data to the forum...
MrExcel HTML Maker or Excel Jeanie
How to post your vba code
[CODE]your VBA code here[/CODE]
The # button in the forum's editor will apply CODE tags around your selected text.
You're welcome. Thanks for the feedback.
You mixed D2 and D1 in the formaula?
=IFERROR(VLOOKUP(D2,Changes!A:B,2,0),D1)
Paste your Excel data to the forum...
MrExcel HTML Maker or Excel Jeanie
How to post your vba code
[CODE]your VBA code here[/CODE]
The # button in the forum's editor will apply CODE tags around your selected text.
Like this thread? Share it with others