ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   MsgBox OKCancel (https://www.excelbanter.com/excel-discussion-misc-queries/14553-msgbox-okcancel.html)

Jasper

MsgBox OKCancel
 
I tried to make a message box which pops u when I hit a button. The question
should be "are you sure?" when OK then it continues to the "Sub
Get_Inkoopdelen_Data()" when Cancel it has to return to the sheet "Index".

I tried:

Sub Bevesiging_ARF_Vullen()

Dim i As Long
Dim rng As Range
Dim intButton As Integer
intButton = MsgBox("Is het bron bestand geopend?" &
vbNewLine
"Klick "OK" om te vervolgen. Klick "Cancel" om terug te keren.",
vbOKCancel + vbInformation, "Kosten Database Vullen")
If intButton = vbCancel Then Exit Sub
If intButton = vbOK Then Sheets("Index").Select
End If
Next i
End Sub


MY QUESTION:

"What code should I use to "get a message box which pops u when I hit the
"Fill Database" button on the INDEX sheet. When the question should be "are
you sure?" when OK then it continues to the "Sub Get_Inkoopdelen_Data()" when
Cancel it has to return to the sheet "Index""?

Thanks in advance!

Jasper

Bob Phillips

Sub Bevesiging_ARF_Vullen()

Dim i As Long
Dim rng As Range
Dim intButton As Integer
intButton = MsgBox("Are you sure?.", _
vbOKCancel + vbInformation, "Kosten Database Vullen")
If intButton = vbOK Then
Get_Inkoopdelen_Data()
ElseIf intButton = vbCancel Then
Sheets("Index").Select
End If
End Sub


--

HTH

RP
(remove nothere from the email address if mailing direct)


"Jasper" wrote in message
...
I tried to make a message box which pops u when I hit a button. The

question
should be "are you sure?" when OK then it continues to the "Sub
Get_Inkoopdelen_Data()" when Cancel it has to return to the sheet "Index".

I tried:

Sub Bevesiging_ARF_Vullen()

Dim i As Long
Dim rng As Range
Dim intButton As Integer
intButton = MsgBox("Is het bron bestand geopend?" &
vbNewLine
"Klick "OK" om te vervolgen. Klick "Cancel" om terug te keren.",
vbOKCancel + vbInformation, "Kosten Database Vullen")
If intButton = vbCancel Then Exit Sub
If intButton = vbOK Then Sheets("Index").Select
End If
Next i
End Sub


MY QUESTION:

"What code should I use to "get a message box which pops u when I hit the
"Fill Database" button on the INDEX sheet. When the question should be

"are
you sure?" when OK then it continues to the "Sub Get_Inkoopdelen_Data()"

when
Cancel it has to return to the sheet "Index""?

Thanks in advance!

Jasper





All times are GMT +1. The time now is 12:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com