Pausing macro to confirm info?

ExcelAtEverything

Active Member
Joined
Jan 30, 2021
Messages
351
Office Version
  1. 2019
Platform
  1. Windows
Hello all! Is there any such code I could place at the start of the green button macro which will pause the macro and pop open a window to ask:
Is this information correct?
James L Example 0123

And then somehow show a Yes/No button of sorts, or some way to either confirm the info before proceeding with running the macro?
Pressing NO would stop macro and send cursor back to C2 for editing. Pressing YES would proceed with macro.
1614745276517.png
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
VBA Code:
If MsgBox("Is this information corect?" & vbLf & vbLf & _
          [C2] & " " & [D2] & " " & [E2] & " " & [F2], _
          vbQuestion + vbYesNo, "") = vbNo Then
    Range("C2").Select
    Exit Sub
End If
 
Upvote 0
That works great Alphafrog! Is there any way to make it so that it shows all four digits of the last field (F2)? As it currently is, if "0123" is input, then that code in the messagebox returns "123".
 
Upvote 0
That works great Alphafrog! Is there any way to make it so that it shows all four digits of the last field (F2)? As it currently is, if "0123" is input, then that code in the messagebox returns "123".
MsgBox Format(Range("F2"), "0000") OR MsgBox Format(Range("F2"), "@")
 
Upvote 0
VBA Code:
If MsgBox("Is this information corect?" & vbLf & vbLf & _
          [C2] & " " & [D2] & " " & [E2] & " " & Format([F2], "0000"), _
          vbQuestion + vbYesNo, "") = vbNo Then
    Range("C2").Select
    Exit Sub
End If
 
Upvote 0
Solution
You guys are amazing! Can't wait til I know the coding side well enough to answer these questions on here myself.
Thx AlphaFrog, and thank you too Lian! ?
 
Upvote 0

Forum statistics

Threads
1,214,387
Messages
6,119,222
Members
448,877
Latest member
gb24

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top