View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Make sheet change stick after Application.Inputbox

That's one of the nice things about using application.goto.

It doesn't need to activate a workbook, then the worksheet.

Peter T wrote:

For completeness might want to do

rng.Parent.Parent.Activate
rng.Parent.Activate

Just in case, there's a bug with Type:=8 on sheets with certain types of CF,
two workarounds here

http://www.jkp-ads.com/Articles/SelectARange.asp

Regards,
Peter T

"RB Smissaert" wrote in message
...
With sticking I mean that it doesn't return to the sheet that was active
when the Application.InputBox was started.

Thanks to both and Range.Parent is the simple answer indeed.

RBS


"Dave Peterson" wrote in message
...
I'm not sure what you mean by sticking, but maybe...

Option Explicit
Sub testme()
Dim myRng As Range
Set myRng = Nothing
On Error Resume Next
Set myRng = Application.InputBox(Prompt:="pick a range", Type:=8)
On Error GoTo 0

If myRng Is Nothing Then
'do nothing
Else
Application.Goto myRng ', scroll:=true
End If

End Sub

Or maybe...

Application.Goto myRng.Parent.range("A1") ', scroll:=true



RB Smissaert wrote:

Is there a simple way to make a sheet change stick that was done while
in
the Application.InputBox dialog (with Type:=8)?
I can do it by parsing out the sheet name from the resulting range and
then
activate that sheet, but I have a feeling that there might be a simpler
way
to do this.

RBS

--

Dave Peterson



--

Dave Peterson