53111

macro vba bei tabellenwechsel ausführen excel

wie mache ich es dass bei einem bestimmten tabellenwechsel innerhalb einer excel mappe eine macro bzw. vba ausgeführt wird.

z.b soll beim wechsel von "tabelle 1" auf "tabelle 2" folgendes für Tabelle 2 ausgeführt werden:
[CODE]
Sub bold()

Dim i%
i = 1
With ActiveWorkbook.Sheets(2)
Do Until i = 50
If .Cells(i, 1).Value = "" Then
.Rows(i - 1).Select
Selection.Font.bold = True
End If
i = i + 1
Loop

End With

End Sub
[/CODE]

umgekehrt sollen auch beim wechsel von tabelle 2 auf tabelle 1 wechsel ausgeführt werden.
Auf Facebook teilen
Auf X (Twitter) teilen
Auf Reddit teilen
Auf Linkedin teilen

Content-ID: 71274

Url: https://administrator.de/forum/macro-vba-bei-tabellenwechsel-ausfuehren-excel-71274.html

Ausgedruckt am: 25.04.2025 um 06:04 Uhr

bastla
bastla 18.10.2007 um 12:07:13 Uhr
Goto Top
Hallo saibonaut!

Rechtsklick auf Blattregister des jeweiligen Tabellenblattes in der Arbeitsmappe - "Code anzeigen", im Codefenster ein "Private Sub Worksheet_Activate()" und / oder "Private Sub Worksheet_Deactivate()" erstellen und den Code aus "Sub bold()" dort platzieren.

Grüße
bastla

P.S.: Zum Formatieren als "Code" nicht , sondern <> verwenden.