+ Reply to Thread
Results 1 to 25 of 25

hiding sheets but still letting macros run when printing hidden sheets

  1. #1
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690

    hiding sheets but still letting macros run when printing hidden sheets

    hi guys
    i have a workbook that has the following sheets

    working sheet
    job sheet
    receipt of deposit letter
    completion sheet
    delivery note
    delivery note (2)
    odd
    even
    t&t
    glass
    ggf

    i want to hide every sheet except the working sheet.
    I have tried this but the macros bring up an error when i run the macro

    my macros involve printing certain pages dependng on what button is pressed

    i get an error whatever
    how do i stop this

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    You need to unhide the sheet

    Please Login or Register  to view this content.
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    thanks for the reply roy
    how ould i incorporate that code into this?

    Please Login or Register  to view this content.
    many thanks

  4. #4
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    if anyone could help it would be appreciated

  5. #5
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Steve, does this work for you?
    Please Login or Register  to view this content.
    Last edited by Paul; 11-10-2008 at 06:20 PM.

  6. #6
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    hi pjoaquin
    thanks for the reply
    it works except for the fact that if i select no it shows the delivery note tab but doesnt mae it the active sheet
    so i guess i should leave that particualr sheet visible?

    what it should do is take me to sheet "delivery note" cell b16
    asking me to input what system im using

    steve
    Last edited by VBA Noob; 11-10-2008 at 06:44 PM.

  7. #7
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    I would think you could just add:
    Please Login or Register  to view this content.
    immediately after the 'Case vbNo' statement. This, of course, would leave it open after the user edited the cell, so you may as well leave it visible.

  8. #8
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    hiya
    im getting this really annoying pop up half way through the macro that says "all worksheets are empty" and then waits for you to click ok and then progresses is there anyway to stop this?

    regards

  9. #9
    Forum Contributor pr4t3ek's Avatar
    Join Date
    10-13-2008
    Location
    Melbourne, Australia
    MS-Off Ver
    2003 & 2007, 2010
    Posts
    483
    you may need to restart your comp...
    --
    Regards
    PD

    ----- Don't Forget -----

    1. Use code tags. Place "[code]" before the first line of code and "[/code"]" after the last line of code. Exclude quotation marks

    2. Thank those who have helped you by Clicking the scales above each post.

    3. Please mark your post [SOLVED] if it has been answered satisfactorily.

  10. #10
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    You can add this at the beginning:
    Please Login or Register  to view this content.
    and this at the end:
    Please Login or Register  to view this content.
    BUT- this message is probably just telling you that there's nothing to print on one or more of the worksheet(s) in question. You may want to step through the code line-by-line to see which sheets are causing this (if it matters to you).

  11. #11
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    hiya

    it still does it but thats not really a big worry
    the problem is that it doesnt do the call SelectSheets part of the macro

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    What is SelectSheets?

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    This has tidied up the code, but you need to test it. I can't see why you are calling a macro called SElectSheets when the sheets are selected.
    Please Login or Register  to view this content.

  14. #14
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    hi roy
    i get an instant error if i click no and it highlights this line

    Please Login or Register  to view this content.
    the call selectsheets

    is a way of checking a box that requires me to select any of 3 boxes that i may need and it prints off the selected sheet(s)
    Last edited by stevesunfold; 11-11-2008 at 02:02 PM.

  15. #15
    Forum Expert Paul's Avatar
    Join Date
    02-05-2007
    Location
    Wisconsin
    MS-Off Ver
    2016/365
    Posts
    6,887
    Notice the capitalization of "Delivery note". Based on other code, my guess is your worksheet name is actually "delivery note".

  16. #16
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    If paul is right then try using Option Compare Text

    Please Login or Register  to view this content.

  17. #17
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    Hi pjoaquin
    no the sheet is definetlly named "Delivery note"
    as soon as i click the no button it brings up

    run time error '1004'
    select method of range class failed

    and highlights the row previously noted

  18. #18
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Maybe if you use GoTo
    Please Login or Register  to view this content.

  19. #19
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    hi roy
    that works well and takes me to the delivery note tab but when i click back OR if i click yes i get this message

    run time error 1004
    select method of sheets class failed

  20. #20
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    It should select the sheets in the array & print them.
    I don't think that you have said what SelectSheets does.

  21. #21
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    select sheets brings up a pop up asking to select
    odd
    even
    t&t

    it has checkboxes that allows me to select any or all of them and then prints the checked sheets

    and the error code highlights this line
    Please Login or Register  to view this content.
    select sheets is actually this code if it helps

    Please Login or Register  to view this content.
    Last edited by stevesunfold; 11-11-2008 at 03:20 PM.

  22. #22
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    bump bump bump

  23. #23
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I think that macro is causing the problem. It will certainly print sheets twice.

  24. #24
    Forum Contributor
    Join Date
    06-23-2007
    Posts
    690
    no roy its not that

    the code that you gave me

    now doesnt bring up the pop up of selectsheets

  25. #25
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    I've just noticed that you are using a DialogSheet. Why, these were replaced by UserForms? I have posted a UserForm to select sheets to print if you serch the forum.

    I think one of the main problems with this project is that you have so many different sources for the code some of which duplicate or conflict.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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