ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Workbook Open Event (https://www.excelbanter.com/excel-programming/303360-workbook-open-event.html)

Stuart[_5_]

Workbook Open Event
 
User opens a workbook with a single sheet.
If I know the sheetname, how may I code:

If the activesheet's name is "abc" Then
in the workbook open event.

Regards


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.714 / Virus Database: 470 - Release Date: 02/07/2004



Owen[_6_]

Workbook Open Event
 

'Try Pasting this on the thisworkbook window in VBE

Private Sub Workbook_Open()

Dim lMsg As Long
Dim strSheet As String

strSheet = "Sheet1"

If ActiveSheet.Name = strSheet Then
lMsg = MsgBox("The Active Sheet is: " &
ActiveSheet.Name)
Else
lMsg = MsgBox("The Active Sheet is: " &
ActiveSheet.Name & Chr(10) & Chr(10) & "Not: " & strSheet)
End If

End Sub


-----Original Message-----
User opens a workbook with a single sheet.
If I know the sheetname, how may I code:

If the activesheet's name is "abc" Then
in the workbook open event.

Regards


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.714 / Virus Database: 470 - Release Date:

02/07/2004


.



All times are GMT +1. The time now is 02:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com