Application.Inputbox acting strangely

A

Alan Webb

Having cleared the problem I queried a while back with
App.Inpbox apparently failing if the box was moved I now
have a further problem that is vexing me somewhat. Code
snips below:

Sub SelectCell(ResOrComp As String)
Dim cRng As Range
Dim ToMany As Boolean
'other irrelevant variables
On Error GoTo mtRange
Do 'Loop to check for multiple range selections
Set cRng = Application.InputBox(prompt:="Select cell to
copy " & ResOrComp & " to", _
Title:="Copy " &
ResOrComp, _
Left:=10, _
Top:=10, _
Type:=8)
On Error GoTo 0
'codeto deal with the result
Loop Until ToMany = False
Me.Show
Exit Sub 'exit if all has worked
mtRange: 'error trap
On Error GoTo 0 'cancel error trapping
MsgBox "No Range selected"
Me.Show
End Sub


This generally works fine, but on some occasions -
normally when I am using a template file that contains
macros but no udf - it throws an error and goes to mtRange
on the Set cRng = line when a range has been selected an
OK clicked.

The error returned is 424 Object required.

Can anyone think what might be causing this. It runs fine
on a blank sheet and often with other sheets open
(including the template) at the same time.

The error comes straight after selecting a range in the
inputbox and clicking OK and does not apparently try to go
elsewhere.

Running xL97 on a Citrix server, but I don't think that
has anything to do with it.

Thanks in advance for any advice you can give. Alan
 
Top