![]() |
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 |
Printing Sheets that only include data
oakman,
That 'subscript out of range' message is because the worksheet Worksheets(Units_Sht_Name) cannot be found. Check that all the names on your Input sheet have corresponding named sheet. If. for example your Input sheet had the names Smith, Jones and Brow but there was no sheet named "Brown" in the workbook and the word Prin appeared beside Brown in the Input sheet - runnung the macro woul generate the 'subscript out of range' message. Regards Seamu -- Message posted from http://www.ExcelForum.com |
Printing Sheets that only include data
Seamus,
You are right! my problem had to do with some of the worksheets that had one lette difference between what I had in the list on my Input sheet and wha the actual name of the sheet was. As they say, God is in the details! Thanks again for your help! I appreciate your taking the time! regard -- Message posted from http://www.ExcelForum.com |
Printing Sheets that only include data
No problem - thanks for the feedback. I'm only pleased that I have bee
able to help someone else considering the amount of help I hav received for the experts around here with problems I have had. regards Seamu -- Message posted from http://www.ExcelForum.com |
All times are GMT +1. The time now is 07:07 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com