+ Reply to Thread
Results 1 to 4 of 4

Progress Indicator - Help Counting Number of Worksheets Formatted

Hybrid View

sowetoddid Progress Indicator - Help... 04-28-2005, 11:28 AM
swatsp0p Something like this should... 04-28-2005, 12:13 PM
sowetoddid Got it, thank you, Bruce. ... 04-28-2005, 12:44 PM
swatsp0p I'm glad that worked for you.... 04-28-2005, 01:52 PM
  1. #1
    Registered User
    Join Date
    10-29-2003
    Posts
    48

    Progress Indicator - Help Counting Number of Worksheets Formatted

    I am using the following code to format all sheets in a workbook to the 11x17. I have many different workbooks that use this code and each workbook has a different number of sheets. How would I count the number of sheets that are being formatted? I am trying to use the progress indicator idea from j-walk's webpage...

    http://j-walk.com/ss/excel/tips/tip34.htm


    Sub PrintWorkbook_Tabloid()
        For Each xWorksheet In ActiveWorkbook.Worksheets
            With xWorksheet.PageSetup
                .LeftHeader = ""
                .CenterHeader = ""
                .RightHeader = ""
                .LeftFooter = ""
                .CenterFooter = ""
                .RightFooter = ""
                .LeftMargin = Application.InchesToPoints(0.5)
                .RightMargin = Application.InchesToPoints(0.25)
                .TopMargin = Application.InchesToPoints(0.25)
                .BottomMargin = Application.InchesToPoints(0.25)
                .HeaderMargin = Application.InchesToPoints(0.5)
                .FooterMargin = Application.InchesToPoints(0.5)
                .PrintHeadings = False
                .PrintGridlines = False
                .PrintComments = xlPrintNoComments
                .CenterHorizontally = True
                .CenterVertically = True
                .Orientation = xlLandscape
                .PaperSize = xlPaperTabloid
                .BlackAndWhite = False
                .FitToPagesWide = 1
                .FitToPagesTall = 1
                .PrintErrors = xlPrintErrorsDisplayed
            End With
        Next xWorksheet
        
        Msg = "This file is about to be printed in Tabloid-size on" & _
            Chr(13) & Chr(13) & Application.ActivePrinter & _
            Chr(13) & Chr(13) & "Would you like to continue?"
        Style = vbYesNo + Exclamation + vbDefaultButton1
        Title = "Print Confirmation"
        Response = MsgBox(Msg, Style, Title)
        If Response = vbYes Then
            ActiveWorkbook.PrintOut
            Exit Sub
        End If
    End Sub
    Thank you.

  2. #2
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    Something like this should work:

    For ii = 1 To Workbooks(1).Sheets.Count
    Next ii

    Msg = "This file is about to be printed in Tabloid-size on" & _
    Chr(13) & Chr(13) & Application.ActivePrinter & _
    Chr(13) & Chr(13) & "A total of "& ii &" pages. "&_Chr(13) & Chr(13) &"Would you like to continue?"
    Style = vbYesNo + Exclamation + vbDefaultButton1


    HTH
    Bruce
    The older I get, the better I used to be.
    USA

  3. #3
    Registered User
    Join Date
    10-29-2003
    Posts
    48
    Got it, thank you, Bruce.

    It is working!!

  4. #4
    Forum Expert swatsp0p's Avatar
    Join Date
    10-07-2004
    Location
    Kentucky, USA
    MS-Off Ver
    Excel 2010
    Posts
    1,545
    I'm glad that worked for you. Thanks for the feedback.

    Cheers!

    Bruce

+ 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