I'm look ing a command to ensure that sample.xls opens on sheet1, no matter what sheet is active when it is closed. Is there also one that ensure sheet2 is clear. Thanks for your help!
I'm look ing a command to ensure that sample.xls opens on sheet1, no matter what sheet is active when it is closed. Is there also one that ensure sheet2 is clear. Thanks for your help!
Hi,Originally Posted by ScottyNM
the codepasted into the ThisWorkBook module will select Sheet1 if it exists.![]()
Option Explicit Private Sub WorkBook_Open() On Error Resume Next Sheets("Sheet1").Select On Error GoTo 0 End Sub
For Sheet2 did you want to clear Values or Formula or both?
---
Si fractum non sit, noli id reficere.
If you want it totally clear, it would probably be easiest to delete the sheet and put in a new one. If that's the case, we can supply you with code (since I can't remember the specifics off the top of my head).
Scott
Thanks. What I did, and it seems to work, is wrote the code to when it initially opens it opens to the second sheet(the one that needs to be cleared) and I did a Cell.ClearContents.
Then I just had it open the first sheet.
It seems to work. If their is a reason I shouldn't do it this way, let me know.
Thanks a lot!
I think the saying is, 'If it works for you . . thats good'.Originally Posted by ScottyNM
just a note on the 'clear', did you put it between the two 'On Error' lines, so that if it failed there was no error shown?
---
Yes. I did include those lines. Thanks!!!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks