Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
1908to1912
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

Makro über mehrere Tabellenblätter

Makro über mehrere Tabellenblätter
21.11.2022 15:00:05
Georg
Liebe Mitglieder,
wie kann ich mit diesem Makro die Tabellenblätter 2 bis 13 gleichzeitig ansprechen? Kriege das gerade nicht hin.
Vielen Dank und Grüße Georg

Sub formatWE()
Dim i As Long
Dim cell As Range
Dim j As Long
'zuerst auslesen, Datumsangaben stehen in Zeile 6-36
For i = 6 To 36
If IsDate(Cells(i, 3).Value) = True Then
'    If IsDate(wsh(j).Cells(i, 3).Value) = True Then
Tabelle1.Cells(i, 2).Value = Tabelle1.Cells(i, 3).Value
End If
Next i
'Formatierungen Wochenende
For Each cell In Range(Cells(6, 2), Cells(36, 2))
If Weekday(cell.Value) = 7 Or Weekday(cell.Value) = 1 Then 'die große Klammer
With cell.Interior
'       .Pattern = xlGray8
.PatternColorIndex = xlAutomatic
.Color = 14403485
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With cell.Font
.Name = "Arial"
.Bold = True
.Size = 9
.Color = 192
End With
'Das Wochentagformat
With cell
.NumberFormat = "ddd"
End With
'Der Rahmen
With cell.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With cell.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With cell.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With cell.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
End If
Next cell
End Sub

5
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: Makro über mehrere Tabellenblätter
21.11.2022 15:11:40
Georg
funktioniert leider nicht, das Makro läuft nur über 1 Blatt.
AW: Makro über mehrere Tabellenblätter
21.11.2022 15:14:14
Rudi
Hallo,
nicht gleichzeitig aber nacheinander.

Sub formatWE()
Dim i As Long, j As Long
Dim cell As Range
Dim w As Integer
For w = 2 To 13
With Worksheets(w)
'zuerst auslesen, Datumsangaben stehen in Zeile 6-36
For i = 6 To 36
If IsDate(.Cells(i, 3).Value) Then
.Cells(i, 2).Value = .Cells(i, 3).Value
End If
Next i
'Formatierungen Wochenende
For Each cell In .Range(.Cells(6, 2), .Cells(36, 2))
If Weekday(cell.Value) = 7 Or Weekday(cell.Value) = 1 Then 'die große Klammer
With cell.Interior
'       .Pattern = xlGray8
.PatternColorIndex = xlAutomatic
.Color = 14403485
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With cell.Font
.Name = "Arial"
.Bold = True
.Size = 9
.Color = 192
End With
'Das Wochentagformat
With cell
.NumberFormat = "ddd"
End With
'Der Rahmen
With cell.Borders(xlEdgeLeft)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With cell.Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With cell.Borders(xlEdgeTop)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
With cell.Borders(xlEdgeRight)
.LineStyle = xlContinuous
.ColorIndex = xlAutomatic
.TintAndShade = 0
.Weight = xlThin
End With
End If
Next cell
End With
Next w
End Sub
Gruß
Rudi
Anzeige
AW: Makro über mehrere Tab....vielen Dank
21.11.2022 16:16:52
Georg
Rudi, ich habe es gleich umgesetzt, bedingte Formatierung habe ich deswegen nicht genommen, weil ich auch wissen wollte, wie man mehrere Tabellenblätter anspricht. Kann man immer gebrauchen. Gruß Georg
AW: Makro über mehrere Tabellenblätter
21.11.2022 16:07:07
onur
Wieso Makro? Dafür reicht eine bedingte Formatierung. Blatt Januar berdingt formatieren und 11x kopieren.

323 Forumthreads zu ähnlichen Themen

Anzeige
Anzeige
Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige