Live-Forum - Die aktuellen Beiträge
Datum
Titel
28.03.2024 21:12:36
28.03.2024 18:31:49
Anzeige
Archiv - Navigation
1612to1616
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
Inhaltsverzeichnis

Fusszeile in Abhänhigkeit vom Zellinhalt

Fusszeile in Abhänhigkeit vom Zellinhalt
21.03.2018 14:29:01
Ralf
Hallo Forum,
Daniel hier aus dem Forum hat mir bei meinem letzten Problem sehr gut weiter geholfen.
Jetzt wollte ich den Code eigenständig erweitern, schaffe dies aber nicht.
Es geht um folgendes:
Ich habe ein Tabellenblatt "Sprachauswahl". Hier wird mittels Optionsfeldern und der verknüpften Zelle F2 eine Sprache ausgewählt und dann auf dem Ergebnisblatt die Sprache angepasst. Daniel hat mir den oberen mit der Kopfzeile zur Verfügung gestellt, jetzt wollte ich selber die Fusszeile hinzufügen.
Das Ergebnis ist aber nicht wie gewünscht. In der Fusszeile wird statt Seite 1 von 2 nun der Pfad geschrieben. Auf der rechten Seite der Fusszeile war eine Grafik eingebunden, die ist jetzt weg. Wieso wird die überschrieben, wenn im Code nur von "CenterFooter" die Rede ist.
Kann mich bitte bei der Richtigstellung der mittleren Fusszeile unterstützen?
Der Prefix 2 Teil ist von mir, der Rest ist von Daniel und funktioniert auch.
Sub Sprachauswahl()
Dim objWS As Worksheet
Dim Prefix As String
Dim FormattedDate As String
Dim FormattedTime As String
Dim PostFix As String
Dim Prefix2 As String
Application.ScreenUpdating = False
Application.PrintCommunication = False
'Kopfzeile
FormattedTime = Format(Time, "hh:mm:ss")
Select Case Worksheets("Sprachauswahl").Cells(2, 6)
Case 1
Prefix = "Druck:"
FormattedDate = Format(Date, "dd. MMMM yyyy")
PostFix = " Uhr von "
Case 2
Prefix = "Print:"
FormattedDate = Format(Date, "MMMM, dd yyyy")
PostFix = " clock by "
Case 3
Prefix = "?"
FormattedDate = Format(Date, "yyyy m dd")
PostFix = "?"
End Select
For Each objWS In ThisWorkbook.Worksheets
objWS.PageSetup.RightHeader = Prefix & _
FormattedDate & " / " & _
FormattedTime & PostFix & Environ("UserName")
Next objWS
'Fußzeile
'Select Case Worksheets("Sprachauswahl").Cells(2, 6)
'Case 1
'Prefix2 = "Seite &Z von &F"
'Case 2
'Prefix2 = "Page &Z of &F"
'Case 3
'Prefix2 = "?"
'End Select
'For Each objWS In ThisWorkbook.Worksheets
'objWS.PageSetup.CenterFooter = Prefix2
'Next objWS
Application.ScreenUpdating = True
Application.PrintCommunication = True
End Sub

Vielen Dank im Voraus für eine Rückmeldung.
Viele Grüße
Ralf

1
Beitrag zum Forumthread
Beitrag zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Fusszeile in Abhänhigkeit vom Zellinhalt
26.03.2018 17:55:56
Dieter
Hallo Ralf,
ich habe den Eindruck, dass die Anweisung Application.PrintCommunication = False ein Problem verursacht.
Der folgende Code hat bei mir funktioniert:
Sub Sprachauswahl()
Dim objWS As Worksheet
Dim Prefix As String
Dim FormattedDate As String
Dim FormattedTime As String
Dim PostFix As String
Dim Prefix2 As String
Dim wb As Workbook
Application.ScreenUpdating = False
Set wb = ThisWorkbook
'Kopfzeile
FormattedTime = Format(Time, "hh:mm:ss")
Select Case wb.Worksheets("Sprachauswahl").Cells(2, 6)
Case 1
Prefix = "Druck:"
FormattedDate = Format(Date, "dd. MMMM yyyy")
PostFix = " Uhr von "
Case 2
Prefix = "Print:"
FormattedDate = Format(Date, "MMMM, dd yyyy")
PostFix = " clock by "
Case 3
Prefix = "?"
FormattedDate = Format(Date, "yyyy m dd")
PostFix = "?"
End Select
For Each objWS In wb.Worksheets
objWS.PageSetup.RightHeader = Prefix & _
FormattedDate & " / " & _
FormattedTime & PostFix & Environ("UserName")
Next objWS
'Fußzeile
Select Case wb.Worksheets("Sprachauswahl").Cells(2, "F")
Case 1
Prefix2 = "Seite &P von &N"
Case 2
Prefix2 = "Page &P of &N"
Case 3
Prefix2 = "?"
End Select
For Each objWS In wb.Worksheets
With objWS.PageSetup
.CenterFooter = Prefix2
End With
Next objWS
Application.ScreenUpdating = True
End Sub
Viele Grüße
Dieter
https://www.herber.de/bbs/user/120684.xlsm
Anzeige

167 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige