LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Junior Member
 
Posts: 24
Talking Help adding a condition to a print code

I am using excel 2000

I am using this code to print staff holiday forms:


Sub PrintHolidayForms()

Dim lngLoop As Long
Dim rngItems As Range

Set rngItems = Worksheets("Holiday Entitlement").Range("ConsultantName")


Worksheets("Holiday Form").Select
ActiveSheet.Unprotect
For lngLoop = 1 To rngItems.Rows.Count

Range("E3") = rngItems.Cells(lngLoop, 1)
ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

Next
ActiveSheet.Protect



End Sub


The range ConsultantName is a dynamic range and contains the staff names, starting in cell B4, the range also contains the words "Vacant" and "Proposed", how do I stop the Vacant and Proposed printing

eg in the list below I only want it to print a form for John and Fred
John
Vacant
Proposed
Fred

Thx

Paul

I solved this by copying and pasting the column of names to a blank worksheet, editing and replacing "Vacant" and "Proposed" with "", to leave blank cells and then used code to remove the blank cells from the list

Thx for looking

Last edited by Paul S : January 18th 12 at 07:23 PM Reason: SOLVED
 
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
adding up sums only if condition is met Doc Behr Excel Worksheet Functions 6 August 16th 09 12:42 PM
Adding up Cells Given a Condition Storm Excel Worksheet Functions 4 March 26th 09 09:00 PM
Adding a second formatting condition. bollard Excel Worksheet Functions 2 August 21st 08 10:24 AM
If formula---adding another condition hmsawyer Excel Discussion (Misc queries) 6 March 29th 08 02:50 PM
Adding numbers that meet a condition? carrera Excel Discussion (Misc queries) 3 July 8th 05 02:31 PM


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