Workbook Opening in Certain Place

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I posted something yesterday and the suggestions I got were good, but they
did not work. What I want to do is everytime a workbook is opened, have it be
opened to a certain place...A1 of the first sheet. I am not the one that will
be using this spreadsheet, I'm just designing it, and I know that the person
using it will not know to save it in A1 of the first sheet before closing
it...how would I go about doing this...go about programming it into VBA?

Thanks...
 
Try putting this code into the "ThisWorkbook" code

Private Sub Workbook_Open()
ThisWorkbook.Worksheets(1).Activate
ThisWorkbook.Worksheets(1).Range("A1").Select
End Sub

HTH,
Barb Reinhardt
 
What is "ThisWorkbook" code?


Barb Reinhardt said:
Try putting this code into the "ThisWorkbook" code

Private Sub Workbook_Open()
ThisWorkbook.Worksheets(1).Activate
ThisWorkbook.Worksheets(1).Range("A1").Select
End Sub

HTH,
Barb Reinhardt
 
I tried those again...and I must be entering them in the wrong place. Where
do I enter them?
 
Hi Elise

Paste the following code into the ThisWorkBook module of your workbook

Private Sub Workbook_Open()
ThisWorkbook.Sheets("Sheet1").Select
Range("A1").Activate
End Sub

Press Alt + F11 to open the Visual Basic Editor
Ctrl + R to ensure the Project Explorer pane is visible.
Double click on this workbook, and paste the code into the large white
pane.
Alt + F11 again to return to Excel and Save the file.

Next time you open you will find the cursor located in A1 of Sheet1,
regardless of where it was at the point of saving.
 
Alt+F11 to open VB editor

On the right hand side select workbook from the dropdown and put then in
there.
select the Open event on the other dropdown and put it in there.

Mike
 
Roger, that will work as long as she doesn't change the worksheet name of
Sheet1 to something else.
 
Back
Top