View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
oakman[_5_] oakman[_5_] is offline
external usenet poster
 
Posts: 1
Default Printing Sheets that only include data

Greetings,

Having posted earlier, I was able to reduce my code thanks to grea
advice from this forum. However I have run into a problem-forgive m
repeating - as before, i have two colums on my Input sheet. The firs
column includes about 36 names that correspond to the sheets in m
workbook. The other column includes a formula to show the word "PRINT
or leave blank, depending on whether there is any data on the shee
with the name on the first column. In addition, I have named the cell
on the second column "UNITS" When i run the macro with the code show
below, I get a "Run-time error '9': Subscrip out of range" and the lin
"Worksheets(Units_Sht_Name).PrintOut Copies:=1, Collate:=True" i
highlighted in yellow.
Any help would be appreciated!

Thank you in advance

Sub printmac
For Each c In Worksheets("Input").Range("UNITS").Cells
If c.Value = "PRINT" Then
Units_Sht_Name = c.Offset(0, -1).Value
With Worksheets
With c.Font
.Bold = True
End With
Worksheets(Units_Sht_Name).PrintOut Copies:=1, Collate:=True
End With
End If
Next c

End Su

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