Pausing macro to confirm info?

ExcelAtEverything

Active Member
Joined
Jan 30, 2021
Messages
298
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

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,400
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
 

ExcelAtEverything

Active Member
Joined
Jan 30, 2021
Messages
298
Office Version
  1. 2019
Platform
  1. Windows
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".
 

Lian

New Member
Joined
Jan 26, 2021
Messages
34
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
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"), "@")
 

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,400
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
 
Solution

ExcelAtEverything

Active Member
Joined
Jan 30, 2021
Messages
298
Office Version
  1. 2019
Platform
  1. Windows
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! 🙏
 

Watch MrExcel Video

Forum statistics

Threads
1,129,687
Messages
5,637,832
Members
416,984
Latest member
dee10

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
Top