Spotycus
New Member
- Joined
- Dec 8, 2015
- Messages
- 25
Hello,
I have a very large excel sheet that uses a lot of VLookups Nested inside of If Statements and the calculation speed is horrible. Can someone help provide me a better way via VBA to accomplish the same goal? I recorded a Macro and added the formulas that are currently in the excel sheet.
The range that I need to make this loop through is ($F$4:$H500) or the named range: "Payee2MemoLookup".
The number of rows needed will vary from use to use based on the values in the "Payee_Subclass" Range
Any help is greatly appreciated!!
I have a very large excel sheet that uses a lot of VLookups Nested inside of If Statements and the calculation speed is horrible. Can someone help provide me a better way via VBA to accomplish the same goal? I recorded a Macro and added the formulas that are currently in the excel sheet.
The range that I need to make this loop through is ($F$4:$H500) or the named range: "Payee2MemoLookup".
The number of rows needed will vary from use to use based on the values in the "Payee_Subclass" Range
Code:
Sub Lookup_Macro()
'
' Lookup_Macro Macro
'
Range("X1").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(Payee_Subclass),"""",VLOOKUP([@SubClass],RulesLookup,3,FALSE))"
Range("G4").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(Payee_Subclass),"""",VLOOKUP([@SubClass],RulesLookup,4,FALSE))"
Range("H4").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(Payee_Subclass),"""",VLOOKUP([@SubClass],RulesLookup,5,FALSE))"
Range("F5").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(Payee_Subclass),"""",VLOOKUP([@SubClass],RulesLookup,3,FALSE))"
Range("G5").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(Payee_Subclass),"""",VLOOKUP([@SubClass],RulesLookup,4,FALSE))"
Range("H5").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(Payee_Subclass),"""",VLOOKUP([@SubClass],RulesLookup,5,FALSE))"
Range("F6").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(Payee_Subclass),"""",VLOOKUP([@SubClass],RulesLookup,3,FALSE))"
Range("G6").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(Payee_Subclass),"""",VLOOKUP([@SubClass],RulesLookup,4,FALSE))"
Range("H6").Select
ActiveCell.FormulaR1C1 = _
"=IF(ISBLANK(Payee_Subclass),"""",VLOOKUP([@SubClass],RulesLookup,5,FALSE))"
Calculate
End Sub
Any help is greatly appreciated!!