Count Number of Print Pages on Worksheet with VBA

Поділитися
Вставка
  • Опубліковано 18 жов 2024

КОМЕНТАРІ • 27

  • @SyedMuzammilMahasanShahi
    @SyedMuzammilMahasanShahi 6 років тому +1

    Thanks for this wonderful video

  • @abdanomer
    @abdanomer 6 років тому

    Thank you
    I would like to know how specify a printer to be printed if I have already two or three setup printers?

    • @Exceltrainingvideos
      @Exceltrainingvideos  6 років тому +1

      Try this code:
      Application.Dialogs(xlDialogPrinterSetup).Show

    • @abdanomer
      @abdanomer 6 років тому

      Thank you Dinesh Kumar Takyar 😃
      If I want it to print without showing the dialogue!
      Just press button it will be print by a printer immediately and another button for another printer?

  • @honestindian2106
    @honestindian2106 2 роки тому

    How to do this same thing of counting pages with word doc. Please help 🙏🏻

  • @jamalal-fayturi4168
    @jamalal-fayturi4168 6 років тому

    Sir
    How can we loop through a folder and copy non contiguous cells or ranges from different sheets in multiple workbooks to my master sheet?
    Your help and support is highly appreciated

    • @Exceltrainingvideos
      @Exceltrainingvideos  6 років тому

      These links will guide: www.exceltrainingvideos.com/transfer-data-multiple-workbooks-master-workbook-automatically/
      www.exceltrainingvideos.com/get-data-from-multiple-sheets-in-multiple-workbooks-into-master-workbook-with-vba/
      www.exceltrainingvideos.com/tag/copy-paste-non-adjacent-cells-excel/
      Or search www.exceltrainingvideos.com

  • @SUKANTA_BAGCHI
    @SUKANTA_BAGCHI 6 років тому

    This Video is very useful. But if I have to Select Multiple Sheet i.e. sheet1, Sheet2 and Sheet3 by holding Control button, then how to know the total number of pages in a msg box or in a cell ?
    let me expalin :
    I have 4 sheet namely --- "Balance Sheet", "Trading Account", "Profit & Loss Account", "P&L Appropriation A/C" and a another sheet named "Invioce" .
    "Balance Sheet" may be varies to 3 or 4 pages, Profit & Loss Account may be 2 or 3 pages.
    I take Rs. 30 for each page being Composed by me along with the 1st Printout
    I make a sheet named "Invoice" Page in which -- "b13" cell is "Total No of Pages" , "D13" is "Rate per page " and "e13" is "Total amount"
    Now I have to Count the Printable page of All the 4 sheets and should be written in the cell "b13" in the sheet named as "Invoice" to calculate the total amount of bill.

    • @Exceltrainingvideos
      @Exceltrainingvideos  6 років тому

      Try this code:
      Dim totpages As Long, gTotPages As Long
      MsgBox Worksheets.Count
      totpages = 0
      gTotPages = 0
      For i = 1 To Worksheets.Count
      With Worksheets(i)
      totpages = Worksheets(i).PageSetup.Pages.Count
      gTotPages = gTotPages + totpages
      End With
      Next i
      MsgBox gTotPages
      Please note that adding data to sheet is easy.

  • @Chanel-minhngoc
    @Chanel-minhngoc 6 років тому

    Thanks

  • @thajudeenkader2560
    @thajudeenkader2560 6 років тому

    Hello Sir, How to create user Login form? i need user enter the user name and password then open excel sheet with press login button. how i do this? pls explain to me thank you

  • @naveednak5113
    @naveednak5113 5 років тому

    agher mai active x listbox mai saari sheet add karo phir mai un me se ek sheet kar ke oos ki total pages kitne he tou ap es pe ke tutorial banae sir

  • @cpkanojiya
    @cpkanojiya 3 роки тому

    सर अगर एक्सेल के हर पेज की अलग अलग pdf बनानी हो और उनका नेम भी उसे शीट से देना हो तो कैसे हो पाएगा। प्लीज हेल्प...

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому

      This Excel VBA lesson will guide: www.exceltrainingvideos.com/convert-multiple-sheets-to-multiple-pdf-files/

  • @anhnhatnguyet4628
    @anhnhatnguyet4628 3 роки тому

    counts the number of pages (except for pages with no data). how ?

    • @Exceltrainingvideos
      @Exceltrainingvideos  3 роки тому

      If I've understood your query, the macro does it based on certain page parameters like a4 size, margins, data, etc.

    • @anhnhatnguyet4628
      @anhnhatnguyet4628 3 роки тому

      can you make a video of my problem ?

    • @anhnhatnguyet4628
      @anhnhatnguyet4628 3 роки тому

      found the code to process the current sheet of the open excel file (except for the page with no data).
      Sub Test ()
      Dim a, i As Long, totPages As Long
      a = GetPageArea (ActiveSheet)
      If IsArray (a) Then
      For i = 1 To UBound (a)
      If Application.CountA (a (i)) Then totPages = totPages + 1
      Next i
      End If
      MsgBox "The number of print pages on the worksheet is" & totPages
      End Sub
      Function GetPageArea (sht As Worksheet)
      Dim a, i As Long, v, z As New Collection
      On Error Resume Next
      z.Add Key: = "R1", Item: = 1
      For Each v In sht.HPageBreaks
      z.Add Key: = "R" & v.Location.Row, Item: = v.Location.Row
      Next v
      i = sht.Cells.SpecialCells (xlCellTypeLastCell) .Row + 1
      z.Add Key: = "R" & i, Item: = i
      On Error GoTo 0
      If z.Count Then
      ReDim a (1 To z.Count - 1)
      For i = 1 To UBound (a)
      Set a (i) = Intersect (sht.UsedRange, sht.Rows (z (i) & ":" & (z (i + 1) - 1)))
      Next i
      GetPageArea = a
      End If
      End Function

  • @rajandas4681
    @rajandas4681 6 років тому

    Sir recently i joined UA-cam. Plz can you to code for. A macro to extract source of each mail. To excel or in outlook itself. Where it can be. Plz..

    • @Exceltrainingvideos
      @Exceltrainingvideos  6 років тому

      This link will help:
      www.exceltrainingvideos.com/get-data-from-outlook-into-excel-worksheet/

    • @rajandas4681
      @rajandas4681 6 років тому

      Dinesh Kumar Takyar sir, i want to view html. Source of email

    • @Exceltrainingvideos
      @Exceltrainingvideos  6 років тому

      Try this code with your PATH and study this Link:
      www.exceltrainingvideos.com/tag/import-data-from-emails-into-excel-worksheet-with-vba/
      For Each OutlookMail In Folder.Items
      If OutlookMail.Subject Like "Our order no 2 for 3000 silk scarves assorted" Then
      sHTML_Body = OutlookMail.HTMLBody
      Debug.Print sHTML_Body
      Exit For
      End If
      Next OutlookMail

  • @TSGuideMan
    @TSGuideMan 2 роки тому

    Not work

    • @Exceltrainingvideos
      @Exceltrainingvideos  2 роки тому +1

      www.exceltrainingvideos.com/count-number-of-print-pages-on-worksheet-with-vba/