MsgBox vbYesNo not working

Status
Not open for further replies.

PCTech

Board Regular
Joined
Mar 24, 2005
Messages
209
This code will bring up the message box but if I click on the yes, I got no results. Will someone please help me figure this out? It is suppose to put a "yes" in AL if I click yes in the message box.

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myLabel As VbMsgBoxResult

i = ActiveCell.Row

If Range("AK" & i) = 1 Then

myLabel = MsgBox("Do you need a BARCODE LABEL", vbYesNo Or vbQuestion, "Labels")
    If myLabel = vbNo Then Exit Sub

End If
    If myLabel = ybYes Then
    Range("AL" & i) = "yes"
    
End If
End Sub
 

Some videos you may like

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Status
Not open for further replies.

Watch MrExcel Video

Forum statistics

Threads
1,108,983
Messages
5,526,056
Members
409,682
Latest member
HisHailo

This Week's Hot Topics

Top