I have a worksheet that tracks data for the year, but I only want to print out data for a current date. How can I do this? For example, my spreadsheets tracks demand for products for a year, and I want to create a button that says "print" but only prints out data for the current date. The spreadsheet will show the entire year of dates in the columns.
Any suggestions on how to print just the current date of informaton? THANKS!
Bagley
You can filter out for the current date and then execute the print command on the filtered data. This can be done manually or if its too time-consuming / tedious, have a macro do it for you.
Cheers,
Arlette
If I helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
Try this,
Click the button.
Enter the date between 2012/1/1 to 2012/7/22 and see if it does what you want.
Sub d() Dim x, c01, c03&, col, LC& Dim ws As Worksheet Application.ScreenUpdating = 0 Set ws = Sheets("Sheet2") x = ws.Cells(1).CurrentRegion c02 = InputBox("Please enter the date you need the column copied for.", "Date") c02 = DateSerial(Year(c02), Month(c02), Day(c02)) On Error GoTo 0 For i = 1 To UBound(x, 2) Set c01 = ws.Columns(i).Find(c02, , xlValues, xlWhole) If Not c01 Is Nothing Then With ws .Cells(1, 7).Resize(UBound(x)).Value = .Cells(1, i).Resize(UBound(x)).Value .PageSetup.PrintArea = Cells(1, 7).CurrentRegion.Address Exit Sub End With End If Next i Application.ScreenUpdating = 1 End Sub
Last edited by JapanDave; 02-11-2012 at 04:30 AM.
If you are happy with the answer, please click the Star icon in the below left hand corner.
Good sites to start learning.
snb's VBA Help Files
Jerry Beaucaires Excel Assistant
J & R Excel Consultancy Services
How to post code correctly: Correct Code Posting
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks