LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 195
Default Print array based on menu choice

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Updating graphs based on choice in drop-down menu: tim_maciejewski Charts and Charting in Excel 1 March 2nd 09 04:45 AM
Updating graphs based on choice in drop-down menu: tim.maciejewski[_2_] Charts and Charting in Excel 0 March 2nd 09 12:41 AM
Updating graphs based on choice in drop-down menu: tim.maciejewski Charts and Charting in Excel 0 March 2nd 09 12:24 AM
Use dd menu choice to filter input for next ddm, etc. William DeLeo Excel Discussion (Misc queries) 6 June 12th 06 09:59 PM
Applying a formula to a drop menu choice Andrew Hill Excel Discussion (Misc queries) 1 January 4th 05 11:05 AM


All times are GMT +1. The time now is 05:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"