BENSON
01-17-2007, 07:17 AM
The code below shows a message box if a criteria is not met ( In this case cell V5 being blank). It allows the user the option to continue or not . I need help with further code so that if cell V5 is not blank the macro will run (ie Copy and paste a selection of data) without showing any message box.
Thanks for any help you can offer
Sub Button4_Click()
'
' Button4_Click Macro
If IsEmpty(Range("v5").Value) Then
Dim strAnswer As VbMsgBoxResult
strAnswer = MsgBox("WARNING NO CLOSING STOCK HAS BEEN ENTERED ,IF YOU CONTINUE THERE WILL BE NO OPENING FOR NEW REPORT ?", vbQuestion + vbYesNo, "Decision time!")
If strAnswer = vbYes Then
'
Range("V5:V240").Copy Range("C5")
Range("D5:Q240,V5:W240").Select
Range("V5").Activate ' Not sure why this is here
Application.CutCopyMode = False
Selection.ClearContents
Selection.ClearComments
End If
End If
End Sub
Thanks for any help you can offer
Sub Button4_Click()
'
' Button4_Click Macro
If IsEmpty(Range("v5").Value) Then
Dim strAnswer As VbMsgBoxResult
strAnswer = MsgBox("WARNING NO CLOSING STOCK HAS BEEN ENTERED ,IF YOU CONTINUE THERE WILL BE NO OPENING FOR NEW REPORT ?", vbQuestion + vbYesNo, "Decision time!")
If strAnswer = vbYes Then
'
Range("V5:V240").Copy Range("C5")
Range("D5:Q240,V5:W240").Select
Range("V5").Activate ' Not sure why this is here
Application.CutCopyMode = False
Selection.ClearContents
Selection.ClearComments
End If
End If
End Sub