My worksheet opens halfway down the page. How can I get it to open at the top?
My worksheet opens halfway down the page. How can I get it to open at the top?
Make sure you are at the top when you SAVE the file. Excel opens to the location you were at when you saved the file.
Alternately, you could put code in the Workbook Open event as such:
[vba]Private Sub Workbook_Open()
Sheets("sheet1").Select
Range("A1").Select
End Sub[/vba]
Adjust the sheet name to meet your requirements.
Good Luck.
Bruce
The older I get, the better I used to be.
USA
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
--
David
Hi, David!
I'm a newbie, so I must ask how to go about putting code in the Workbook
Open event. Thanks!
"David" wrote:
> 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
>
> --
> David
>
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???
unbehaun wrote:
>
> Hi, David!
>
> I'm a newbie, so I must ask how to go about putting code in the Workbook
> Open event. Thanks!
>
> "David" wrote:
>
> > 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
> >
> > --
> > David
> >
--
Dave Peterson
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!
"Dave Peterson" wrote:
> 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???
>
>
>
> unbehaun wrote:
> >
> > Hi, David!
> >
> > I'm a newbie, so I must ask how to go about putting code in the Workbook
> > Open event. Thanks!
> >
> > "David" wrote:
> >
> > > 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
> > >
> > > --
> > > David
> > >
>
> --
>
> Dave Peterson
>
Is it possible that your worksheets are named other than 'Sheet1'? If so, change the reference in the macro to match the name of the sheet you want to open to.
good luck
Bruce
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.
unbehaun wrote:
>
> 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!
> "Dave Peterson" wrote:
>
> > 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???
> >
> >
> >
> > unbehaun wrote:
> > >
> > > Hi, David!
> > >
> > > I'm a newbie, so I must ask how to go about putting code in the Workbook
> > > Open event. Thanks!
> > >
> > > "David" wrote:
> > >
> > > > 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
> > > >
> > > > --
> > > > David
> > > >
> >
> > --
> >
> > Dave Peterson
> >
--
Dave Peterson
Renaming it did the trick. Thanks!
"swatsp0p" wrote:
>
> Is it possible that your worksheets are named other than 'Sheet1'? If
> so, change the reference in the macro to match the name of the sheet
> you want to open to.
>
> good luck
>
> Bruce
>
>
> --
> swatsp0p
>
>
> ------------------------------------------------------------------------
> swatsp0p's Profile: http://www.excelforum.com/member.php...o&userid=15101
> View this thread: http://www.excelforum.com/showthread...hreadid=373890
>
>
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" wrote:
> 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.
>
>
> unbehaun wrote:
> >
> > 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!
> > "Dave Peterson" wrote:
> >
> > > 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???
> > >
> > >
> > >
> > > unbehaun wrote:
> > > >
> > > > Hi, David!
> > > >
> > > > I'm a newbie, so I must ask how to go about putting code in the Workbook
> > > > Open event. Thanks!
> > > >
> > > > "David" wrote:
> > > >
> > > > > 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
> > > > >
> > > > > --
> > > > > David
> > > > >
> > >
> > > --
> > >
> > > Dave Peterson
> > >
>
> --
>
> Dave Peterson
>
If you see Fred or his father Earl (both former co-workers), say hey for me!
unbehaun wrote:
>
> 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" wrote:
>
> > 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.
> >
> >
> > unbehaun wrote:
> > >
> > > 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!
> > > "Dave Peterson" wrote:
> > >
> > > > 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???
> > > >
> > > >
> > > >
> > > > unbehaun wrote:
> > > > >
> > > > > Hi, David!
> > > > >
> > > > > I'm a newbie, so I must ask how to go about putting code in the Workbook
> > > > > Open event. Thanks!
> > > > >
> > > > > "David" wrote:
> > > > >
> > > > > > 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
> > > > > >
> > > > > > --
> > > > > > David
> > > > > >
> > > >
> > > > --
> > > >
> > > > Dave Peterson
> > > >
> >
> > --
> >
> > Dave Peterson
> >
--
Dave Peterson
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks