PDA

View Full Version : Solved: Print page by user input



RonNCmale
11-16-2012, 04:41 AM
I have this workbook with two tabs; sheet1"Employees", sheet2"schedule". On sheet2 there are 13 individual schedules with 28 day period. I'm trying to add a way the user can activate a button on sheet1 that ask for the user to input the month and only schedules with that month would print. Is anything like this possible? Or any other ideas to print an individual schedule. I've attached a stripped down workbook for your review.

kumark
11-19-2012, 02:54 AM
Can u just Post the Output Required

RonNCmale
11-19-2012, 10:27 PM
Kumark, I want to be able to print the schedule corresponding with the month entered ie: If the user input January the VBA code would bring up the schedule for January to be printed. If two pay periods had the same month the user would be able to print both pay periods. I hope this clears things up. Thanks in advance.:help

RonNCmale
11-23-2012, 07:35 PM
Found the code to search by text but can't seem to get it to print the page it is found on. Any help would be greatly appreaciated. See attached workbook.

RonNCmale
11-27-2012, 02:18 PM
If anyone is interested, A solution was found by Naming the ranges, for example, the Named Range for Jan=Schedule!R1C1:R40C35 and adding Sub FindAll()
Dim strFind As String
Dim wks As Worksheet
Dim rngFound As Range
Dim lngItems As Long
strFind = InputBox(prompt:="Enter Month to find", Title:="Find what?")
If Len(strFind) > 0 Then
For Each wks In ActiveWorkbook.Worksheets
If FindIt(wks, strFind, lngItems) = False Then Exit For
Next wks End If
MsgBox lngItems & " matches found"
Range(strFind).PrintOut '<-----------Add this line End Sub


solution found here:http://www.excelforum.com/excel-programming-vba-macros/877009-print-individual-page-by-user-input.html