Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Auto_open won't run on multiple files
I have 3 workbooks for weekly payroll: Management, Admins, and Agents.
Each file has 7 worksheets, named "Sunday", through "Saturday". Different people pull up each file and some forget to select the correct day before editing. So as my first try at VBA, created the code below to select the correct worksheet. My auto_open routines work fine if opening each file seperately. But if selecting all three files and choosing open, only one auto_open runs. Using xl 2003 on a network. Sub auto_open() Dim mydate As Date mydate = Weekday(Now) If mydate = 1 Then ThisWorkbook.Sheets(1).Select ElseIf mydate = 2 Then ThisWorkbook.Sheets(2).Select ElseIf mydate = 3 Then ThisWorkbook.Sheets(3).Select ElseIf mydate = 4 Then ThisWorkbook.Sheets(4).Select ElseIf mydate = 5 Then ThisWorkbook.Sheets(5).Select ElseIf mydate = 6 Then ThisWorkbook.Sheets(6).Select ElseIf mydate = 7 Then ThisWorkbook.Sheets(7).Select End If End Sub The filenames will change periodically and we only open all three files at the end of the day. I tried using workbook_open with renaming all three subroutines to unique names with the same results. I'm also curious, what's the shortest code to accomplish the above? |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
view multiple files in multiple windows on multiple screens. | Excel Discussion (Misc queries) | |||
Batch file to start multiple excel files with auto_open() macro. Delay code needed | Excel Programming | |||
Problem with multiple Auto_Open Macro's | Excel Programming | |||
Auto_open & Application.ontime in shared files | Excel Programming | |||
Import multiple files macro can't find files | Excel Programming |