Microsoft 365 and Office | Development | Other
Building custom solutions that extend, automate, and integrate Microsoft 365 apps.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
hello all,
i try to write a function on vba. Function's input is name. it takes name and checking a list, if name exist, there is a discount. If name does not exist at list, it print zero related cell. But my function does not control the list and always return zero. How can i fix it? My function as follows:
Function NameDisc(vntName) As Double
Dim vntMy_range As Variant
vntMy_range = Worksheets("Special").Range("A1:B23")
If vntName = Worksheets("Special").Range("A2:A23").Text Then
NameDisc = Application.WorksheetFunction.VLookup(vntName, vntMy_range, 2, False)
Else
NameDisc = 0
End If
End Function
Building custom solutions that extend, automate, and integrate Microsoft 365 apps.
An implementation of Visual Basic that is built into Microsoft products.