Input box needs cancel macro


Posted by Keith on July 05, 2000 7:34 AM

Help!

Does anyone out there know how to add a "Cancel" way out clause.

The code below works really well except if you try to cancel from the input box the debug screen comes up.

I need a code that will return to say cell "A1" if cancel is pressed.

I've tried but can't get it to work.

Any help would - Help.

Cheers,

Keith. (Code below)

ActiveSheet.DrawingObjects(Application.Caller).Select
ActiveSheet.ChartObjects("Chart 3").Activate
ActiveChart.SetSourceData Source:=Range("i21").Application.InputBox( _
prompt:="Select Source Range for Chart", Type:=8)

Posted by Coreen on November 15, 2000 12:06 PM

Re: Sorry there's a problem (InputBox - Cancel)

Has anyone found a solution to this? I'm having the exact same problem now. If I choose Cancel on my input box it works fine. If I enter a value it stops and highlights "If intName = False Then". A piece of my code is below...

Dim strName As String

strName = Application.InputBox("Prompt", "Title")
If strName = False Then Exit Sub
Range("G4").Value = strName

Help?

Coreen

Posted by Keith on July 06, 0100 1:35 AM

Cheers

Super, smashing, great!

Cheers Ryan.

Posted by Keith on July 06, 0100 6:59 AM

Sorry there's a problem

Sorry there's a problem.

It cancels well, but it doesn't take the input range. It highlights "If InputRange = False Then"

Any thoughts?

Keith

Posted by Ryan on July 05, 0100 9:02 AM

Keith,
Here you go, let me know if this solves the problem!
Ryan


Dim InputRange As Variant

ActiveSheet.DrawingObjects(Application.Caller).Select
ActiveSheet.ChartObjects("Chart 3").Activate
InputRange = Range("i21").Application.InputBox(prompt:="Select Source Range for Chart", Type:=8)
If InputRange = False Then Exit Sub

ActiveChart.SetSourceData Source:=InputRange



Posted by Ryan on July 06, 0100 1:22 PM

Re: Sorry there's a problem

Keith,

It's hard to know what's going on without having all the objects that the code is refering to. If you want to send me the file, i'll take a look at it.

Ryan