Posts vlookup in vba
Post
Cancel

vlookup in vba

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
'src - https://www.exceltrick.com/formulas_macros/vlookup-in-vba/

Sub FINDSAL()
	On Error GoTo MyErrorHandler:
	Dim E_name As String
	E_name = InputBox("Enter the Employee Name :")
	If Len(E_name) > 0 Then
		Sal = Application.WorksheetFunction.VLookup(E_name, Sheet1.Range("B3:D13"), 3, False)
		MsgBox "Salary is : $ " & Sal
	Else
		MsgBox ("You entered an invalid value")
	End If
	Exit Sub
	MyErrorHandler:
	If Err.Number = 1004 Then
		MsgBox "Employee Not Present in the table."
	End If
End Sub

origin - http://www.pipiscrew.com/?p=13651 vlookup-in-vba

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags