Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Interupt code with message before it runs
I want to include the option to accept or cancel an action before the code
runs. Private Sub Filldown_formula_Click() Range("C10").Select Selection.AutoFill Destination:=Range("C10:C7800"), Type:=xlFillDefault Range("C10:C7800").Select End sub By including this msgBox which includes a Yes or No command buttons. MsgBox "This will reset the formula, do you wish to proceed" Thank you if you can help. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Interupt code with message before it runs
Try the below
Private Sub Filldown_formula_Click() If MsgBox("This will reset the formula, do you wish to proceed", _ vbYesNo + vbDefaultButton2) = vbYes Then Range("C10").AutoFill Destination:=Range("C10:C7800"), Type:=xlFillDefault End If End Sub -- Jacob "Gotroots" wrote: I want to include the option to accept or cancel an action before the code runs. Private Sub Filldown_formula_Click() Range("C10").Select Selection.AutoFill Destination:=Range("C10:C7800"), Type:=xlFillDefault Range("C10:C7800").Select End sub By including this msgBox which includes a Yes or No command buttons. MsgBox "This will reset the formula, do you wish to proceed" Thank you if you can help. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Interupt code with message before it runs
The code still ran even though the "No" option was selected.
"Jacob Skaria" wrote: Try the below Private Sub Filldown_formula_Click() If MsgBox("This will reset the formula, do you wish to proceed", _ vbYesNo + vbDefaultButton2) = vbYes Then Range("C10").AutoFill Destination:=Range("C10:C7800"), Type:=xlFillDefault End If End Sub -- Jacob "Gotroots" wrote: I want to include the option to accept or cancel an action before the code runs. Private Sub Filldown_formula_Click() Range("C10").Select Selection.AutoFill Destination:=Range("C10:C7800"), Type:=xlFillDefault Range("C10:C7800").Select End sub By including this msgBox which includes a Yes or No command buttons. MsgBox "This will reset the formula, do you wish to proceed" Thank you if you can help. |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Interupt code with message before it runs
Copy paste the code and try
If MsgBox("This will reset the formula, do you wish to proceed", _ vbYesNo + vbDefaultButton2) = vbYes Then Range("C10").AutoFill Destination:=Range("C10:C7800"), Type:=xlFillDefault End If -- Jacob "Gotroots" wrote: The code still ran even though the "No" option was selected. "Jacob Skaria" wrote: Try the below Private Sub Filldown_formula_Click() If MsgBox("This will reset the formula, do you wish to proceed", _ vbYesNo + vbDefaultButton2) = vbYes Then Range("C10").AutoFill Destination:=Range("C10:C7800"), Type:=xlFillDefault End If End Sub -- Jacob "Gotroots" wrote: I want to include the option to accept or cancel an action before the code runs. Private Sub Filldown_formula_Click() Range("C10").Select Selection.AutoFill Destination:=Range("C10:C7800"), Type:=xlFillDefault Range("C10:C7800").Select End sub By including this msgBox which includes a Yes or No command buttons. MsgBox "This will reset the formula, do you wish to proceed" Thank you if you can help. |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Interupt code with message before it runs
I made a typo error. Sorry for the false alarm.
"Jacob Skaria" wrote: Copy paste the code and try If MsgBox("This will reset the formula, do you wish to proceed", _ vbYesNo + vbDefaultButton2) = vbYes Then Range("C10").AutoFill Destination:=Range("C10:C7800"), Type:=xlFillDefault End If -- Jacob "Gotroots" wrote: The code still ran even though the "No" option was selected. "Jacob Skaria" wrote: Try the below Private Sub Filldown_formula_Click() If MsgBox("This will reset the formula, do you wish to proceed", _ vbYesNo + vbDefaultButton2) = vbYes Then Range("C10").AutoFill Destination:=Range("C10:C7800"), Type:=xlFillDefault End If End Sub -- Jacob "Gotroots" wrote: I want to include the option to accept or cancel an action before the code runs. Private Sub Filldown_formula_Click() Range("C10").Select Selection.AutoFill Destination:=Range("C10:C7800"), Type:=xlFillDefault Range("C10:C7800").Select End sub By including this msgBox which includes a Yes or No command buttons. MsgBox "This will reset the formula, do you wish to proceed" Thank you if you can help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
macro runs fine but error message is displayed | Excel Programming | |||
Warning message while macro runs | Excel Programming | |||
Interupt processing | Excel Discussion (Misc queries) | |||
Display a message whilst a macro runs | Excel Programming | |||
Display a message whilst a macro runs | Excel Programming |