vijay.vizzu
Member
Hi all,
Below is my code, its working fine, but one problem is that,i can't able to put error handler like in my case, if vendor code not found in vendor details sheet, then it should display a message "Vendor code not found". Please helpe me to resolve this.
[pre]
[/pre]
Below is my code, its working fine, but one problem is that,i can't able to put error handler like in my case, if vendor code not found in vendor details sheet, then it should display a message "Vendor code not found". Please helpe me to resolve this.
[pre]
Code:
Sub venAddress()
Dim findVenCD As Integer 'Inputted vendor code
Dim vendName As String 'To fetch vendor name from vendor database
Dim venCD As Integer 'Find vendor code & retrive the data from vendor database
Dim venAdd As String 'To fetch vendor address
Dim genPO As String
Application.ScreenUpdating = False
findVenCD = [vendcd] 'Inputted vendor code
Worksheets("vendor_details").Activate
venCD = WorksheetFunction.Match(findVenCD, Range("b:b"), 0) 'To match inputted vendor code in VendorDB
vendName = WorksheetFunction.Index(Range("c:c"), venCD, 0) 'To display vendor name in the range
venAdd = WorksheetFunction.Index(Range("d:d"), venCD, 0) 'To display vendor address in the range
genPO = "IYM/PROTO/010/" & Worksheets.Count - 3 + 1 'To create sequence number
[vendcd] = findVenCD 'puts inputted vendor code in the range
[venName] = vendName 'puts vendor name in the range
[venAddr] = venAdd 'puts vendor address in the range
[poNo.] = genPO 'puts sequence number
[poDate] = Now() 'puts current date
Sheets("Template").Activate
Application.ScreenUpdating = True
End Sub