+ Reply to Thread
Results 1 to 44 of 44

Apply filters prior to printing

  1. #1
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Apply filters prior to printing

    I would like to apply the filter "Greater than 0" to column W and then automatically print the document.

  2. #2
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Here are the files.
    Last edited by DAULT; 12-07-2017 at 03:16 PM.

  3. #3
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    So, step-by-step, this is what my goal is.
    -The macro would do the following:
    -Filter the Job List based Column I and Column J. The filter would be 'greater than 0'.
    -Open each Job Cost Ledger associated with the project numbers from the filtered results from Step A.
    -Within each Job Cost Ledger, carry out the following steps:
    -Filter Job Cost Ledger to display 'greater than 0' for Column U9:U as well as Column W9:W and Y9:Y. Columns U and V must filter using the merged cells if possible.
    -Print the document.
    -Clear filter.
    -Close the document and proceed to next Job Cost Ledger.
    Do both Columns I and Column J in Job List have to be greater than 0 for the row to be visible or can only one of the 2 columns be greater than 0 for it to be visible?
    Do Columns U, W and Y all have to be greater than 0 for the row to be visible or can only one or two of the 3 columns be greater than 0 for it to be visible?
    Filtering with the merged cells (columns U and V) is going to be a problem. I'll play around with it and see what I can do.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  4. #4
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    I think if either of the cells has data they should be displayed. Essentially by deleting the data first the cells without an associated Job Cost Ledger will stay empty.

    Columns U, W and X should all be kept if any of them have any data of any format. That will eliminate some of the issues with the merged cells. By replacing Y with X, that should help since both rows from the period will have data if either of them do.

    Without reformatting and recreating the entire Job Cost Ledger and formulas I am not sure how else to eliminate the merged cells.

  5. #5
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    I think that I have managed to solve the problem with the filtering with the merged cells. I have to unmerge the cells in columns U and W. Then I need to create a helper column in column AA duplicating the values from column U in both rows that were previously merged and then filter on AA instead of U. Then AA can be cleared because it isn't needed after the filtering. My time is getting a little tight so I'll work on it when I can and respond as soon as possible. It would be strongly advisable to avoid merged cells completely. Do a quick search into "Centre Across Selection". Sometimes this can help avoiding merged cells.

  6. #6
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Here is another option. What if I presented a date cell in the ledger that was the start date of the project. Then a filter could be applied to HIDE all rows prior to the start date and after then current date.

    After thinking about this some more, I think this might be the better options as then during the project duration there would also be representation of when nothing was done.

  7. #7
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    OK. Before I start working on my previous idea, attach a revised Ledger workbook with the necessary changes and explain again in detail how you want it to work.

  8. #8
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Ok. Sorry for the confusion on this, but I am trying to help to simplify your work because I really appreciate the effort you are putting in to this. There really is no change to the form other than noted below.

    If Cell B8 contained the start date of the project, then the filter could be applied to keep ALL rows where the date in Column B9:B is between the date in B8 and the current date.

    I realize I would have to revise the formulas in Column B that calculate the dates, but I can work on that side of things if you can make the filter work.
    Last edited by DAULT; 12-06-2017 at 01:03 PM.

  9. #9
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    Sounds good. Give me a little bit of time and I'll get back to you as soon as I can.

  10. #10
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    There is a problem filtering on both columns I or J. It's possible but requires slightly modifying the page. If there is a value in column I of the Job List, will you get the desired result if the data is filtered only on column I being >0 ?

  11. #11
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    I think that should be fine. I don't see where there could be data in Column I and not J because I is the value of the work we have completed and J is the value of our invoicing to date.

  12. #12
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    OK. While I work on the filtering, here is a line of code you can add to clear the contents of Column H2:H and Column I2:I
    Place this line:
    Please Login or Register  to view this content.
    above this line:
    Please Login or Register  to view this content.

  13. #13
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Perfect. How can I eliminate the following error:

    "We can't update some of the links in your workbook right now. You can continue without updating their values, or edit the links you think are wrong"

    The error appears because there are links to future timesheets. Since we will have new timesheet files for each year I didn't want to have to go into every active project to update the links in the formulas. Therefore each ledger includes two years of dates.

  14. #14
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    To be honest, I don't know how to eliminate the error message. You can try Application.DisplayAlerts = False ..... Application.DisplayAlerts = True
    I noticed a typo in the original macro. Please change to this: Dim srcWB As Workbook
    I have a draft macro for you to try. I couldn't test it because of the date issue that you still have to fix in column B. Place the macro in a regular module in Job List. You can place it in the same module you currently have.
    Please Login or Register  to view this content.

  15. #15
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Ok, so something I did do is moved the date from cell b8 to cell s3, however I fixed that in the macro you sent.

    The filter of the job list appears to work. I tried creating new files, importing the data using the previous macro and then running the new one and that part works fine.

    After the macro opens the first file I receive a Runtime Error '91': Object variable or With block variable not set. Also, the filter in the Job Cost Ledger doesn't apply correctly and ends up not displaying any lines of data even though the date is set to October 31 in cell S3.

  16. #16
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    Can you attach copies of the files you are using?

  17. #17
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Files attached.

    What I did was created three ledgers for the first three jobs in the list and then ran the macro from the ribbon.
    Last edited by DAULT; 12-07-2017 at 03:17 PM.

  18. #18
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    Try these macros. I've made some modifications to both. You shouldn't get the update links message.
    Please Login or Register  to view this content.

  19. #19
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Do these both go in the Job List file?

  20. #20
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    Yes they do. Replace whatever is already there.

  21. #21
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Done. Everything seems to function fine without any errors, however the filter on the ledger file is taking away all lines. The attached picture is what the ledger looks like when it prints.

  22. #22
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    One more thing. One more thing. Can you give me just the portion of the macro to filter then job list and another one to clear the filter? I know I can do this with the filter option in Excel, however if the person using it doesn't know Excel well they can just use buttons I place in the ribbon.

  23. #23
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    Happy to see that all is working without errors. The picture of the printout wasn't attached.
    This will filter:
    Please Login or Register  to view this content.
    This will clear the filter:
    Please Login or Register  to view this content.

  24. #24
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Not sure why, but I keep getting an error when I try to attach the image of the filtered file. Essentially what it prints is the portion of the file above Row 9.
    Last edited by DAULT; 12-07-2017 at 12:41 PM.

  25. #25
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    Still no attachment.

  26. #26
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Not sure why, but I keep getting an error when I try to attach the image of the filtered file. Essentially what it prints is the portion of the file above Row 9.

  27. #27
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    The other filters work perfectly. Thank you.

  28. #28
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    I have some panes frozen in the ledger file - would that make a difference in the filter being applied? Also, the dates are calculated and not text if that would matter.

  29. #29
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    Try this version:
    Please Login or Register  to view this content.

  30. #30
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    It still does the same thing. It is something to do with the filter on the ledger portion. Does the ledger have to be a macro enabled file?

  31. #31
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Could it have something to do with starting the filter at A1, since that cell doesn't have a date? The range should start at A9 shouldn't it?

  32. #32
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    This is what I'm getting (see attachment).
    Attached Files Attached Files

  33. #33
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Hmmm... What I get is the top bar with all of the job information, but no dates.

  34. #34
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    See attached.
    Attached Files Attached Files

  35. #35
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    I blacked out the information on purpose by the way.

  36. #36
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    This is exactly how I would like to have it look except that the dates needs to be included and I would like cell at the bottom wiht the job number to remain also.

  37. #37
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    I just noticed an error in the file you sent to me. The first date is December 2, however then the next date is November 5. The first date in the actual ledger with values is October 9 and December 5 doesn't appear anywhere.

    I noticed the date from the job list is October 31, so it won't be displaying time before then from the ledger.

  38. #38
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    Based on the sample file that I revised for testing and a start date of October 31, the data filtered correctly. Only the dates between October 31 and today appear. The following macro is the best I can do in terms of filtering. I tried different approaches to get the printout to look like your attachment but the merged cells in rows 5, 6 and 7 cause havoc. You could get the Project number to appear if you place it in any row above row 6.
    Please Login or Register  to view this content.

  39. #39
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    How much difference would it make if I tried to eliminate the merged cells above? Those ones are easy to merge - the ones below with the dates are the ones that are more difficult.

  40. #40
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    I really don't know. You could try to unmerge the cells in rows 5, 6 and 7 and try the macro and see what happens.

  41. #41
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Well...it works now other than the project number at the bottom of the page...

  42. #42
    Registered User
    Join Date
    12-01-2017
    Location
    Ontario.
    MS-Off Ver
    2016
    Posts
    75

    Re: Apply filters prior to printing

    Thank you so much for your help with all of this. Very much appreciated.

  43. #43
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    You are very welcome. If I can figure out how to add the project number, I'll let you know.

  44. #44
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,821

    Re: Apply filters prior to printing

    I think this one will work a little better for you even without unmerging the cells in row 5, 6 and 7.
    Please Login or Register  to view this content.
    Last edited by Mumps1; 12-08-2017 at 10:40 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Apply Multiple Filters
    By Vcare in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-04-2017, 12:51 PM
  2. [SOLVED] Apply 'X only to records that has Filters applied
    By nironto in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-09-2013, 07:07 AM
  3. [SOLVED] Warning pop up prior to printing
    By jon_wolf69 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-06-2013, 07:19 AM
  4. Apply Filters to each Cell
    By chris8877 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 10-08-2012, 06:06 AM
  5. [SOLVED] VBA to apply & remove filters
    By kenadams378 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-25-2012, 10:17 AM
  6. I want to be able to apply the filters to my count()
    By erison in forum Excel General
    Replies: 6
    Last Post: 07-06-2012, 03:37 PM
  7. Requiring Information prior to printing a page...
    By ButchDavis in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-06-2010, 01:04 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1