How can I get VBA to perform a vlookup in a range of cells. Right now I have this formulas in cells like below.
Cell A8 = IF(C8>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A9 = IF(C9>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A10 = IF(C10>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A11 = IF(C11>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A12 = IF(C12>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A13 = IF(C13>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A14 = IF(C14>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A15 = IF(C15>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A22 = IF(C22>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A23 = IF(C23>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A24 = IF(C24>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A25 = IF(C25>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A26 = IF(C26>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A27 = IF(C27>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A28 = IF(C28>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A29 = IF(C29>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
I'd like to be able to perform these lookups in VBA because the users start messing with and changing things. And these lookups would need to run when the user would click an OK command button on a userform.
Thanks in advance
Excel 2016
Cell A8 = IF(C8>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A9 = IF(C9>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A10 = IF(C10>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A11 = IF(C11>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A12 = IF(C12>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A13 = IF(C13>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A14 = IF(C14>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A15 = IF(C15>"",VLOOKUP($A$7,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A22 = IF(C22>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A23 = IF(C23>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A24 = IF(C24>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A25 = IF(C25>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A26 = IF(C26>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A27 = IF(C27>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A28 = IF(C28>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
Cell A29 = IF(C29>"",VLOOKUP($A$21,'Employee Data'!$B$4:$D$27,2,0),"")
I'd like to be able to perform these lookups in VBA because the users start messing with and changing things. And these lookups would need to run when the user would click an OK command button on a userform.
Thanks in advance
Excel 2016