Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printing Worksheet only if data exists

Greetings,

I have a list with about 36 names on Sheet 1. (Each of these name
corresponds to a sheet with the same name in the workbook.) Next t
each name on the list, I have entered a formula to show the wor
"PRINT" if any data is present on that sheet or leave the cell blank i
no data is present. I am currently using a For Each ... Then loop t
scan the aforementioned range of cells so that if the word "PRINT
appears next to the sheet name, the corresponding worksheet shoul
print. However, I cannot figure out how to tell the macro to print th
particular worksheet once it finds the word "PRINT". Any pointers ar
very much appreciated. Please help!

Thanks in advance!

Sub PrintMac()
For Each c In Worksheets("Sheet1").Range("SALES").Cells
If c.Value = "Print" Then
Worksheets
With c.Font
.Bold = True
.Italic = True
End With
End If
Next c


End Su

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printing Worksheet only if data exists

Hi oakman,

I altered your code slightly and I was able to get it to print th
required sheets. See below:


Sub PrintMac()
For Each c In Worksheets("Sheet1").Range("SALES").Cells
If c.Value = "Print" Then
Sales_Sht_Name = c.Offset(0, -1).Value
With Worksheets
With c.Font
.Bold = True
.Italic = True
End With
Worksheets(Sales_Sht_Name).PrintOut Copies:=1, Collate:=True
End With
End If
Next c
End Sub


Regards

Seamu

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Printing Worksheet only if data exists

Thank you so much Seamus!

This slight change has made a big difference.

Regards

Oakman.

--
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
Create Worksheet BUT If It Already Exists... Dave Excel Discussion (Misc queries) 2 October 30th 07 11:13 PM
Printing multiple worksheets only if data exists hailnorm Excel Programming 6 January 10th 04 07:09 PM
Worksheet Exists... James Weaver Excel Programming 3 October 6th 03 02:56 PM
How can I tell if a worksheet exists? Robert Stober Excel Programming 5 October 3rd 03 01:00 AM
check if worksheet exists Craig Wilks Excel Programming 2 July 10th 03 04:07 AM


All times are GMT +1. The time now is 05:00 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"