View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Dianne Butterworth[_2_] Dianne Butterworth[_2_] is offline
external usenet poster
 
Posts: 19
Default Code is not working....please take a look!!!

How about:

Sub test()

Dim sht As Worksheet

Select Case Worksheets("Menu").Range("L12").Value
Case 2
For Each sht In Sheets(Array("sheet1", "sheet2", "sheet3", "sheet4",
"sheet5", "sheet6"))
sht.Range("ac1:ax79").PrintOut
Next sht
Case 3
For Each sht In Sheets(Array("lays", "bistro", "kettle",
"layslights", "stax", "ruffles"))
sht.Range("ay1:bt79").PrintOut
Next sht
Case 4
For Each sht In Sheets(Array("lays", "bistro", "kettle", "lays
lights", "stax", "ruffles"))
sht.Range("bu1:cw79").PrintOut
Next sht
Case Else
MsgBox ("Please enter quarter you wish to print in cell L12 on the
Menu tab")
End Select

End Sub

--
Dianne Butterworth

I'm having some problems with my code.

Here is what is NOT working:

I'm not getting Sheet2 thru Sheet5...it is only printing Sheet1...any
suggestions as to why??

Also, my message box is not popping up if the cell is blank???



If Range("l12") = 2 Then
Sheets(Array("sheet1", "sheet2", "sheet3", "sheet4", "sheet5",
"sheet6")).Select
Range("ac1:ax79").PrintOut
If Range("l12") = 3 Then
Sheets(Array("lays", "bistro", "kettle", "lays
lights", "stax", "ruffles")).Select
Range("ay1:bt79").PrintOut
If Range("L12") = 4 Then
Sheets(Array("lays", "bistro",
"kettle", "lays lights", "stax", "ruffles")).Select
Range("bu1:cw79").Print
If Range("l12") = " " Then
MsgBox ("Please enter quarter
you wish to print in cell L12 on the Menu tab")
End If
End If
End If
End If


---
Message posted from http://www.ExcelForum.com/