A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Workbook_Open code help



 
 
Thread Tools Display Modes
  #1  
Old April 5th, 2010, 01:17 AM posted to microsoft.public.excel.misc
Colin Hayes
external usenet poster
 
Posts: 313
Default Workbook_Open code help


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
  #2  
Old April 5th, 2010, 02:13 AM posted to microsoft.public.excel.misc
Colin Hayes
external usenet poster
 
Posts: 313
Default Workbook_Open code help

In article , Paul
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.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:27 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.