Mrrrr's Forum (VIEW ONLY)
Un forum care ofera solutii pentru unele probleme legate in general de PC. Pe langa solutii, aici puteti gasi si alte lucruri interesante // A forum that offers solutions to some PC related issues. Besides these, here you can find more interesting stuff.
Lista Forumurilor Pe Tematici
Mrrrr's Forum (VIEW ONLY) | Reguli | Inregistrare | Login

POZE MRRRR'S FORUM (VIEW ONLY)

Nu sunteti logat.
Nou pe simpatie:
DEEA25 25 ani
Femeie
25 ani
Mures
cauta Barbat
25 - 51 ani
Mrrrr's Forum (VIEW ONLY) / Tutoriale si Ghiduri Utile // Tutorials and useful guides / [EXCEL] Create Dynamic Print Area for More/Less Rows [VBA] Moderat de TRaP, TonyTzu
Autor
Mesaj Pagini: 1
Mrrrr
AdMiN

Inregistrat: acum 17 ani
Postari: 2186
You can create it without VBA, see here:

With VBA, you can use the following code:


Sub PrintDynamicRange()

Application.ScreenUpdating = False
Dim LastRow, LastCol As Long

With ActiveSheet
    LastRow = .Cells(Rows.Count, 2).End(xlUp).Row 'this works also fine: LastRow = [LOOKUP(2,1/(B1:B65536<>""),ROW(B1:B65536))]
    LastCol = .Cells(1, .Columns.Count).End(xlToLeft).Column
                .PageSetup.PrintArea = Range(Cells(1, 1), Cells(LastRow, LastCol)).Address

        ActiveSheet.PrintPreview               ' PRINT PREVIEW FIRST
'        ActiveSheet.PrintOut                            ' PRINT IMMEDIATELY ON DEFAULT PRINTER
End With

Application.ScreenUpdating = True
End Sub


_______________________________________


pus acum 5 ani
   
Pagini: 1  

Mergi la