Confirm Users Selection in Message Box

MSingh
3StarLounger
Posts: 366
Joined: 12 May 2010, 06:49

Confirm Users Selection in Message Box

Post by MSingh »

Hi,

How can i display a user selection in a message box:

User selection is stored in Range("A100")
Range("A100") = Batch

Sub ConfirmSelection()

Dim Response As VbMsgBoxResult
Response = MsgBox("Are you sure you want to delete Batch ..... ?" & vbCrLf & _
vbCrf & _
"This process is Irreversible!", vbCritical + vbYesNo, "Confirm Selection")
If Response = vbYes Then

'rest of code to delete


Thanks Again
Mohamed

User avatar
HansV
Administrator
Posts: 74138
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Confirm Users Selection in Message Box

Post by HansV »

Use concatenation with the & operator:

Response = MsgBox("Are you sure you want to delete Batch " & Range("A100") & "?" & vbCrLf & _
vbCrf & _
"This process is Irreversible!", vbCritical + vbYesNo, "Confirm Selection")
Regards,
Hans

MSingh
3StarLounger
Posts: 366
Joined: 12 May 2010, 06:49

Re: Confirm Users Selection in Message Box

Post by MSingh »

Thanks Hans,
That was 110%

Kind Regards
Mohamed