View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 1,327
Default Object required.

Hi Alex

Did you declare the variables ? Did you account for invalid entries and
Cancel ?

This should take care of both:

Sub Test()
Dim rArea As Range
Dim rXValues As Range
Dim rYValues As Range
On Error Resume Next
Set rArea = Application.InputBox(prompt:="Select range:", Type:=8)
If rArea Is Nothing Then Exit Sub
Set rXValues = Application.InputBox(prompt:="Select XValues:", Type:=8)
If rXValues Is Nothing Then Exit Sub
Set rYValues = Application.InputBox(prompt:="Select YValues:", Type:=8)
If rYValues Is Nothing Then Exit Sub
End Sub

HTH. Best wishes Harald

"y" skrev i melding ...
Set rArea = Application.InputBox(prompt:="Select range:", Type:=8)
Set rXValues = Application.InputBox(prompt:="Select XValues:",

Type:=8)
Set rYValues = Application.InputBox(prompt:="Select YValues:",

Type:=8)


It worked fine.
Now it reports the error in subject to me.
Sometime VBA crashes on the 1st instruction, sometime on the 2nd.

I hope to translate correct the error message because I'm using the

italian version of VBA.

Thanks, Alex.