Hi all,
I have a VBA when it will execute after a hotkey is pressed. Basically to vlookup the value present on cell B onto C, D, E, etc.
If I want to modify it such that it will detect that there is value in cell B2, and automatically execute the vlookup in C2, D2, E2, etc.
Right now, if any of the cell in B is changed, will need to press the hotkey for them to re-calculate.
Attached is the excel screenshot.
Any help will be appreciated, thanks a lot.
2013-03-03 23_43_01-Microsoft Excel - Label Issue - RTS List - Supplier Info.png
Sub Macro5()
'
' Macro5 Macro
'
' Keyboard Shortcut: Ctrl+Shift+H
'
Range("C2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(LEFT(RC[-1],5),'DIR - L'!C:C[4],5,FALSE)"
Range("D2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(LEFT(RC[-2],12),'DIR - L'!C[-2]:C[4],7,FALSE)"
Range("E2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(LEFT(RC[-3],12),'DIR - L'!C[-3]:C[6],10,FALSE)"
Range("F2").Select
ActiveCell.FormulaR1C1 = _
"=VLOOKUP(LEFT(RC[-4],12),'DIR - L'!C[-4]:C[9],14,FALSE)"
Range("G2").Select
ActiveCell.FormulaR1C1 = "=VLOOKUP(RC[-5],'DIR - L'!C[-6]:C[-1],6,FALSE)"
Range("H2").Select
ActiveCell.FormulaR1C1 = "=RC[-3]&"" - ""&RC[-2]"
Range("H3").Select
Columns("H:H").EntireColumn.AutoFit
Range("C2:H2").Select
Selection.AutoFill Destination:=Range("C2:H" & Range("B" & Rows.Count).End(xlUp).Row)
Range("C2:H" & Range("B" & Rows.Count).End(xlUp).Row).Select
End Sub
Bookmarks