Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· openaiHugging Face Suzhen/CodeChat

I need a VBA code that will force the sheet 'AdminMCS' to activate when the workbook is…

  1. User

    I need a VBA code that will force the sheet 'AdminMCS' to activate when the workbook is opened

  2. Assistant

    You can use the Workbook_Open event in VBA to force the sheet "AdminMCS" to activate when the workbook is opened. Here's an example of how you can implement this:

    1. Press Alt + F11 to open the VBA editor.
    2. In the Project Explorer on the left side, find and double-click on the workbook where you want to add the code.
    3. In the code window that appears, enter the following code:
    Private Sub Workbook_Open()
        Sheets("AdminMCS").Activate
    End Sub
    
    1. Save the workbook and close the VBA editor.

    Now, whenever the workbook is opened, it will automatically activate the "AdminMCS" sheet.