Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code is not working....please take a look!!!

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...an
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", "lay
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 quarte
you wish to print in cell L12 on the Menu tab")
End If
End If
End If
End I

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code is not working....please take a look!!!

If Range("l12") = 2 Then
Sheets(Array("sheet1", "sheet2", "sheet3", "sheet4", "sheet5"
"sheet6")).Select
Range("ac1:ax79").PrintOut
End If

If Range("l12") = 3 Then
Sheets(Array("lays", "bistro", "kettle", "lays lights", "stax"
"ruffles")).Select
Range("ay1:bt79").PrintOut
End If

If Range("L12") = 4 Then
Sheets(Array("lays", "bistro", "kettle", "lays lights", "stax"
"ruffles")).Select
Range("bu1:cw79").Print
End If

If Range("l12") = "" Then
MsgBox ("Please enter quarter you wish to print in cell L12 on the Men
tab")
End I

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code is not working....please take a look!!!

Better yet...


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

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

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code is not working....please take a look!!!

It's still only printing Sheet1..

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Code is not working....please take a look!!!

Try this...

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

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



  #6   Report Post  
Posted to microsoft.public.excel.programming
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/



Reply
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
VBA Code Not Working tictox Excel Discussion (Misc queries) 3 October 25th 10 04:25 PM
VBA Code Not Working tictox Excel Discussion (Misc queries) 0 July 6th 10 06:40 PM
VB Code Is Not Working Rob Excel Discussion (Misc queries) 2 May 30th 07 05:23 PM
Code not working Todd Huttenstine Excel Programming 1 June 10th 04 05:06 PM
Code not Working - Help please Brian Excel Programming 2 November 18th 03 10:58 PM


All times are GMT +1. The time now is 09:30 AM.

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"