sweater_vests_rock
Well-known Member
- Joined
- Oct 8, 2004
- Messages
- 1,657
Everyone.
I want to use an input box to pull a range detailing on what sheets the user wishes a program to be run. Here is the code:
What is bothering me is that
1) if I click "Cancel" when the Input Box occurs on the worksheet in run mode, I receive a 424 error and the code breaks. How can I avoid this code break?
2) if I click "OK" without highlighting any cells, I receive a function/formula error, similar to if something is typed incorrectly in a cell formula. How can I use the loop to avoid this I have written, rather than the loop VB is forcing?
Thanks. Ben.
I want to use an input box to pull a range detailing on what sheets the user wishes a program to be run. Here is the code:
Code:
Do
Set rng_Input_Box = Application.InputBox("Select the worksheets from the list in Column A on which you wish to run this program. If you wish to use all worksheets, select 'All Sheets'.", "Worksheet Selection", Type:=8)
If IsEmpty(rng_Input_Box) = True Then
Msg = MsgBox("You have not selected any worksheets.", vbRetryCancel + vbInformation, "Error: No Worksheets Selected")
ElseIf rng_Input_Box = (Cells(1, 1)) Then
Set rng_ws = Range(Cells(2, 1), Cells(ws_count, 1))
Else
Set rng_ws = rng_Input_Box
End If
Loop While IsEmpty(rng_Input_Box) = True And Msg = vbRetry
What is bothering me is that
1) if I click "Cancel" when the Input Box occurs on the worksheet in run mode, I receive a 424 error and the code breaks. How can I avoid this code break?
2) if I click "OK" without highlighting any cells, I receive a function/formula error, similar to if something is typed incorrectly in a cell formula. How can I use the loop to avoid this I have written, rather than the loop VB is forcing?
Thanks. Ben.