From: Colin Hayes on

HI

I'm trying to put code in the open workbook area so that sheet1 and
sheet2 both open with the cursor on A200.

I'm getting errors with this code :

Sheets("Sheet1").Range("A200").Select
Sheets("Sheet2").Range("A200").Select


Can anybody advise how to do this?

Thanks
From: Paul on

Hi Colin,

You're getting errors because Sheet2 is not the active sheet when
you're trying to select cell A200. Try this instead:




Code:
--------------------



Private Sub Workbook_Open()
With Application
.ScreenUpdating = False
.Goto Sheets("Sheet1").Range("A200"), scroll:=True
.Goto Sheets("Sheet2").Range("A200"), scroll:=True
.ScreenUpdating = True
End With
End Sub

--------------------







C
o
l
i
n

H
a
y
e
s
;
6
9
0
1
3
1

W
r
o
t
e
:


>
HI
>
> I'm trying to put code in the open workbook area so that sheet1 and
> sheet2 both open with the cursor on A200.
>
> I'm getting errors with this code :
>
> Sheets("Sheet1").Range("A200").Select
> Sheets("Sheet2").Range("A200").Select
>
>
> Can anybody advise how to do this?
>
> Thanks


--
Paul

- Paul
------------------------------------------------------------------------
Paul's Profile: 1697
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=192875

http://www.thecodecage.com/forumz

From: Colin Hayes on
In article <Paul.48x6ll(a)thecodecage.com>, Paul
<Paul.48x6ll(a)thecodecage.com> writes
>
>Hi Colin,
>
>You're getting errors because Sheet2 is not the active sheet when
>you're trying to select cell A200. Try this instead:
>Code:
>--------------------
>
>Private Sub Workbook_Open()
> With Application
> .ScreenUpdating = False
> .Goto Sheets("Sheet1").Range("A200"), scroll:=True
> .Goto Sheets("Sheet2").Range("A200"), scroll:=True
> .ScreenUpdating = True
> End With
> End Sub

Hi Paul

OK Thanks for your help.

I couldn't get it working , unfortunately. I think it's my fault in that
I do have some other code already there which may be interfering.


This is the code I already have :

Private Sub Workbook_Open()

Dim mysheets As Sheets
Set mysheets = Worksheets(Array(1))
For Each Sheet In mysheets
Sheets("Sheet1").ScrollArea = "A1:L26"
Sheets("Sheet2").ScrollArea = "A1:L26"

Next

Range("A200").Select


End Sub


Can your code be integrated to have the desired effect?

Thanks again for your time and expertise.

 | 
Pages: 1
Prev: Using Cartesian Cell Names
Next: Paste Value Error