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  dBforums > PC based Database Applications > Microsoft Excel > Make sheet active when workbook opens

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-28-04, 14:02
VBALordCorp VBALordCorp is offline
Registered User
 
Join Date: Jul 2004
Posts: 34
Make sheet active when workbook opens

I need to make sure that everytime the workbook opens it opens to sheet1

The Activate Method code doesn't seem to be working I keep getting an error

ThisWorkbook.Worksheet("Sheet1").Activate

How do I take care of this?
Reply With Quote
  #2 (permalink)  
Old 07-28-04, 14:14
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Try this:

ThisWorkbook.Worksheets("Sheet1").Activate
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #3 (permalink)  
Old 07-29-04, 09:33
VBALordCorp VBALordCorp is offline
Registered User
 
Join Date: Jul 2004
Posts: 34
No go

That was a no go it still isnt working. The caption of the work book is open ECN's. Sheet one's tabe is "open ECN log" but in the VBA tree they are still Thisworkbook and sheet1. have any more advice?
Reply With Quote
  #4 (permalink)  
Old 07-29-04, 09:57
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
This is the code that should work. I used "mySheet" as the worksheet name for the test. Put in the actual name of your worksheet.

Code:
Private Sub Workbook_Open()
    Worksheets("mySheet").Activate
End Sub
Where are you putting this code? It should not go in a general module. If you are in Excel, go to icon to left of File, right click and select "View Code". Then in VBE, in upper left dropdown, select Workbook. Then put this code.
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
  #5 (permalink)  
Old 07-29-04, 10:31
VBALordCorp VBALordCorp is offline
Registered User
 
Join Date: Jul 2004
Posts: 34
peachy keen

thanks that worked!!!!!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On