View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
gerdmain gerdmain is offline
external usenet poster
 
Posts: 13
Default Changing view as well as selection from code.

Hi AVR,

You can use Application.Goto to select and position to the destination cell,
but it also activates the sheet. Just switch back to the current sheet
afterwards.

e.g.
sn = Activesheet.Name
Application.Goto Reference:=Worksheets("Sheet B").Range("A1"), scroll:=True
Sheets(sn).Activate

--
Gerd


"AVR" wrote:

Using something like the following code, I was able to change the selection
in sheets other than the active sheet, transparent to the user. However,
this code does not change the view upon entering the sheets. Is there a way
to shift what will be displayed, comparable to hitting the "Home" key? I.e.,
the selected cell in the top left corner of the view upon entering the sheet.

Sub SetActiveCell()
application.ScreenUpdating = False
set sh = Activesheet
With Worksheets("Sheet B")
.Select
.Range("A1").Select
End with
sh.Activate
Application.ScreenUpdating = True
End sub