Hello
I would like to achive two criterias with VBA code
Crietria 1
1. Msgbox "Pl Enter in Col B4:B20" if someone enters in range other than range B4:B20
Criteria 2
in range from B4 to D20
2.
Another msgbox to be displayed if someone entered in range from B4 to D20
For eg
in col C which is Target.Offset of Col B as seen below in code. Msgbox "You cant enter in this range Only for Vlook up values"
so if some enters from range B4 to D20 then msg
How can i Achieve the above with below code ?
SamD
120
I would like to achive two criterias with VBA code
Crietria 1
1. Msgbox "Pl Enter in Col B4:B20" if someone enters in range other than range B4:B20
Criteria 2
in range from B4 to D20
2.
Another msgbox to be displayed if someone entered in range from B4 to D20
For eg
in col C which is Target.Offset of Col B as seen below in code. Msgbox "You cant enter in this range Only for Vlook up values"
so if some enters from range B4 to D20 then msg
How can i Achieve the above with below code ?
VBA Code:
myLookupValue = Target.Value
If Target.Count = 1 Then
If Not Intersect(Range("B4:B20"), Target) Is Nothing Then
On Error Resume Next
Set myTableArray = wsMF.Range("B4:F840")
myVLookupCode = Application.WorksheetFunction.VLookup(myLookupValue, myTableArray, CodeColndx, False)
myVLookupRate = Application.WorksheetFunction.VLookup(myLookupValue, myTableArray, RateColndx, False)
On Error GoTo 0
If myVLookupCode <> "" Then '
Target.Offset(, 1).Value = myVLookupCode
Target.Offset(, 2).Value = myVLookupRate
Else
MsgBox myLookupValue & " Prod.code Does Not Exists " & vbCrLf & "Please Enter Correct Prod.code"
End If
End If
End If
120
Last edited: