Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
InputBox
Hi
I have the following inputbox which returns a range selected by the user. Set rRange = Application.InputBox(Prompt:="Please select any entry within " _ & vbCrLf & "the row you would like to amend.", _ Title:="Select a row", Type:=8) If however the user selects nothing and then clicks ok, an error box pops up:- "The formula you have typed contains an error etc". Is it possible to have an alternative message box pop up which would say something like - "You have not made a selection, please try again!." I could then redirect to the inputbox, by way of a goto. I hope I am making sense. Sandy |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
InputBox
Sandy,
try this: Sub RangeData() Dim rRange As Range On Error Resume Next Application.DisplayAlerts = False Set rRange = Application.InputBox _ (Prompt:="Please select any entry within " _ & vbCrLf & "the row you would like to amend.", _ Title:="Select a row", Type:=8) On Error GoTo 0 Application.DisplayAlerts = True If rRange Is Nothing Then Debug.Print "cancelled" Exit Sub Else rRange.Value = "OK" End If End Sub Note the use of both, On Error Resume Next and Application.DisplayAlerts = False. These stop Excel from trying to handle any bad input from the user, or if they Cancel. Hope helpful -- jb "Sandy" wrote: Hi I have the following inputbox which returns a range selected by the user. Set rRange = Application.InputBox(Prompt:="Please select any entry within " _ & vbCrLf & "the row you would like to amend.", _ Title:="Select a row", Type:=8) If however the user selects nothing and then clicks ok, an error box pops up:- "The formula you have typed contains an error etc". Is it possible to have an alternative message box pop up which would say something like - "You have not made a selection, please try again!." I could then redirect to the inputbox, by way of a goto. I hope I am making sense. Sandy |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
InputBox | Excel Programming | |||
Need InputBox Help | Excel Programming | |||
Inputbox help... | Excel Programming | |||
Inputbox and Application.InputBox | Excel Programming | |||
inputbox | Excel Programming |