
Originally Posted by
6StringJazzer
You should declare variables underneath the Sub declaration, unless there is a need to make them global (usually not).
You are checking to see if ButtonOneClick is TRUE. Where in your code do you give it a value? If you never give it a value, it defaults to FALSE so the If condition will be FALSE and you will never see the MsgBox.
Please show all of your code.
How do I give ButtonOneClick a value? I am new into Excel VBA so I have been learning it myself with the help of people in this forum.
Here is all my code. Its not very complicated as its only for a simple task.
Sub Copy()
Dim ButtonOneClick as Boolean
If [P2] = Empty Then
[P2] = [D39]
Else
Range("P" & Rows.Count).End(xlUp).Offset(1) = [D39]
End If
If [N8] <> "" And ButtonOneClick = True Then
MsgBox "Please Press Reset Button", vbCritical, "Error"
End If
End Sub
Bookmarks