Page Position

K

koreanwarbaby

My worksheet opens halfway down the page. How can I get it to open at the top?
 
S

swatsp0p

Make sure you are at the top when you SAVE the file. Excel opens to th
location you were at when you saved the file.

Alternately, you could put code in the Workbook Open event as such:

Private Sub Workbook_Open()
Sheets("sheet1").Select
Range("A1").Select
End Sub

Adjust the sheet name to meet your requirements.

Good Luck
 
D

David

swatsp0p wrote
Alternately, you could put code in the Workbook Open event as such:

Private Sub Workbook_Open()
Sheets("sheet1").Select
Range("A1").Select
End Sub

Or,
Application.Goto Sheets(1).Range("A1"), True
 
U

unbehaun

Hi, David!

I'm a newbie, so I must ask how to go about putting code in the Workbook
Open event. Thanks!
 
D

Dave Peterson

Fred????

Open your workbook
rightclick on the excel icon to the left of the File|Edit|View dropdown options.
Select view code.

Paste swatsp0p's code in there

Back to excel
save your workbook
close it
reopen it with macros enabled.

Did it work???
 
U

unbehaun

Dave,

I've seen a "Fred" in my family history book. Where's he from? I live in
NW Minnesota, but my clan is from Richland Center, Wisconsin (an hour NW of
Madison).

If I put the cursor at the top, then save, it opens at the top. But this is
inconvenient.

Followed your directions, then had to reduce the security level. When I
enable the macro, I get a "Run-time error '9': Subscript out of range." When
I debug, the second line is highlighted in yellow.

Any help you can give is appreciated!
 
S

swatsp0p

Is it possible that your worksheets are named other than 'Sheet1'? I
so, change the reference in the macro to match the name of the shee
you want to open to.

good luck

Bruc
 
D

Dave Peterson

Fred is a former co-worker in northern Illinois--so maybe...

This line specifies the name of the worksheet.

Sheets("sheet1").Select

Change Sheet1 to the name of the sheet you really want selected when the
workbook opens.

Dave,

I've seen a "Fred" in my family history book. Where's he from? I live in
NW Minnesota, but my clan is from Richland Center, Wisconsin (an hour NW of
Madison).

If I put the cursor at the top, then save, it opens at the top. But this is
inconvenient.

Followed your directions, then had to reduce the security level. When I
enable the macro, I get a "Run-time error '9': Subscript out of range." When
I debug, the second line is highlighted in yellow.

Any help you can give is appreciated!
 
U

unbehaun

Renaming it was the solution--thanks! I know that Fred Unbehaun is related,
but I've never met him (probably third cousin by now). We have a family
reunion the last Sunday in June in SW Wisconsin, but I don't know if he
comes. I can't make it this year because I'm gonna be a GRANDPA in a couple
of weeks! Bye, Dave!

Dave Peterson said:
Fred is a former co-worker in northern Illinois--so maybe...

This line specifies the name of the worksheet.

Sheets("sheet1").Select

Change Sheet1 to the name of the sheet you really want selected when the
workbook opens.
 
D

Dave Peterson

If you see Fred or his father Earl (both former co-workers), say hey for me!
Renaming it was the solution--thanks! I know that Fred Unbehaun is related,
but I've never met him (probably third cousin by now). We have a family
reunion the last Sunday in June in SW Wisconsin, but I don't know if he
comes. I can't make it this year because I'm gonna be a GRANDPA in a couple
of weeks! Bye, Dave!
 
Top