AW: Seitenzahl mit VBA
09.03.2004 09:31:34
Hajo_Zi
Hallo
bei Deinem Level kannst Du was mit folgenmdem Code anfangen. Es wird die aktuelle Seite gedruckt.
Option Explicit
Sub AktuelleSeiteDrucken()
' Von JensF
Dim Seite As Long
Seite = SeitenNr()
ActiveWindow.SelectedSheets.PrintOut From:=Seite, To:=Seite, Copies:=1, Collate:=True
End Sub
Function SeitenNr() As Long
Dim x As Long
Dim Zelle As Range
Dim HBs As Long, VBs As Long
Dim H As Long, V As Long
Set Zelle = ActiveCell
HBs = Tabelle1.HPageBreaks.Count
VBs = Tabelle1.VPageBreaks.Count
H = 1
V = 1
For x = 1 To HBs
If Tabelle1.HPageBreaks(x).Location.Row <= Zelle.Row Then
H = H + 1
Else
Exit For
End If
Next
For x = 1 To VBs
If Tabelle1.VPageBreaks(x).Location.Column <= Zelle.Column Then
V = V + 1
Else
Exit For
End If
Next
SeitenNr = H + (V - 1) * (HBs + 1)
End Function
Bitte keine Mail, Probleme sollten im Forum gelöst werden.
Microsoft MVP für Excel
Das Forum lebt auch von den Rückmeldungen.
Betriebssystem XP Pro und Excel Version XP Pro