Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I know how to add a custom menu and populate it with items from an array
list and perform an .OnAction based on menu item clicked. Right now I have this in Personal.xls: Private Sub OpenTheFile() With Application.CommandBars.ActionControl Workbooks.Open "C:\DATA\EXCEL\" & .Caption End With End Sub This one doesn't get run until I want a different list. Private Sub AddMenu() Dim vFile, vFiles vFiles = Array("MyCheckBook", "DT Biweekly Timesheet", "Foodcost", "Who_Ate", "GFS Inventory", "Attendance Stats", "TimeSheet", "Class Utilization", "Class Signups", "Unit Signups") With Application.CommandBars("Worksheet Menu Bar") With .Controls.Add(msoControlPopup, befo=2, temporary:=False) ..Caption = "D&aily Files" For Each vFile In vFiles With .Controls.Add(msoControlButton) ..Caption = vFile ..OnAction = "OpenTheFile" End With Next End With End With End Sub I plan to populate my new workbook's custom menu with vDay = array("Monday","Tuesday","Wednesday","Thursday") What I want to do is print sheets where A1's value will call a sub() and loop through an array of 6 classes based on the day I choose from that custom menu. Example: MonArr = Array("Class1","Class2","Class3","Class4","Class5" ,"Class6") TueArr = Array("Class1","Class2","Class3","Class4","Class5" ,"Class6") WedArr = Array("Class1","Class2","Class3","Class4","Class5" ,"Class6") ThuArr = Array("Class1","Class2","Class3","Class4","Class5" ,"Class6") I will, of course, replace ClassX with actual class names Here's what I do now, with sheet code: Private Sub Worksheet_Change(ByVal Target As Range) ' Here's where I want the day's array of 6 classes to go If Target.Address = "$A$1" Then Select Case Target.Value Case "Beginning Computer", "Intermediate Computer", "Adult Basic Education", "Creative Writing" Range("A14:A20").EntireRow.Hidden = True Range("E11").Value = 4 Case Else ActiveSheet.Rows.Hidden = False Range("E11").Value = 11 End Select Range("H2").Value = Date ActiveSheet.UsedRange ActiveSheet.PrintOut End If End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$A$1" Then ActiveWindow.Zoom = 100 Else ActiveWindow.Zoom = 55 End If End Sub User selects a class from data valadation list in A1 and a sheet for that class is printed. User repeats for each desired class What I want to do is print sheets where A1's value will loop through an array of 6 classes based on the day I choose from my custom menu Example: MonArr = Array("Class1","Class2","Class3","Class4","Class5" ,"Class6") TueArr = Array("Class1","Class2","Class3","Class4","Class5" ,"Class6") WedArr = Array("Class1","Class2","Class3","Class4","Class5" ,"Class6") ThuArr = Array("Class1","Class2","Class3","Class4","Class5" ,"Class6") I will, of course, replace ClassX with actual class names Class names vary each day, but are static for that day I hope I haven't provided too much or too little info to describe my needs. -- David |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Updating graphs based on choice in drop-down menu: | Charts and Charting in Excel | |||
Updating graphs based on choice in drop-down menu: | Charts and Charting in Excel | |||
Updating graphs based on choice in drop-down menu: | Charts and Charting in Excel | |||
Use dd menu choice to filter input for next ddm, etc. | Excel Discussion (Misc queries) | |||
Applying a formula to a drop menu choice | Excel Discussion (Misc queries) |