Thema Datum  Von Nutzer Rating
Antwort
09.10.2016 21:00:32 Justin
NotSolved
10.10.2016 00:11:40 Gast81741
***
Solved
11.10.2016 17:01:14 Nobody
NotSolved
15.10.2016 16:50:02 Gast96938
NotSolved
15.10.2016 17:03:49 Gast55806
NotSolved
Blau VBA Code auf ganze Arbeitsmappe ausführen
15.10.2016 18:17:08 Gast11064
NotSolved
15.10.2016 19:49:48 Gast70117
NotSolved
15.10.2016 20:52:47 Gast3524
NotSolved
15.10.2016 21:17:29 Gast97459
NotSolved
16.10.2016 00:08:57 Justin
NotSolved
16.10.2016 01:34:46 Gast39271
*****
Solved
16.10.2016 11:54:05 Justin
Solved

Ansicht des Beitrags:
Von:
Gast11064
Datum:
15.10.2016 18:17:08
Views:
775
Rating: Antwort:
  Ja
Thema:
VBA Code auf ganze Arbeitsmappe ausführen

Hallo,

...ah ja, Du befindest dich jetzt in einem Workbook-Event, da mußt Du explizit auf das jeweilige Sh-Objekt referenzieren:

Option Explicit                                     ' Variablendefinition erforderlich

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    '***********************************************
    '* H. Ziplies                                  *
    '* 07.11.12                                    *
    '* erstellt von HajoZiplies@web.de             *
    '* http://Hajo-Excel.de/                       *
    '***********************************************
    ' Fülfarbe
    ' für Schrift RaZelle.Font.ColorIndex
    Dim RaBereich As Range                  ' Variable für Bereich
    Dim RaZelle As Range                    ' Variable für Zelle
    If Sh Is Worksheets("Überblick") Then '// hier ggF. für weitere TabBlätter anpassen..
        Set RaBereich = Sh.Range("B6:CO22")        ' Bereich der Wirksamkeit
        Set RaBereich = Intersect(RaBereich, Target)
        If Not RaBereich Is Nothing Then
            For Each RaZelle In RaBereich
                With RaZelle
                    Select Case UCase(RaZelle.Value) ' Umwandlung der Eingabe in Großbuchstaben
                        Case "W"
                            .Interior.Color = Sh.Cells(6, 3).Interior.Color
                            .Font.Color = Sh.Cells(6, 3).Font.Color
                            .Value = Sh.Cells(6, 3).Value
                        Case "S"
                            .Interior.Color = Sh.Cells(6, 6).Interior.Color
                            .Font.Color = Sh.Cells(6, 6).Font.Color
                            .Value = Sh.Cells(6, 6).Value
                        Case "F"
                            .Interior.Color = Sh.Cells(6, 9).Interior.Color
                            .Font.Color = Sh.Cells(6, 9).Font.Color
                            .Value = Sh.Cells(6, 9).Value
                        Case "BR"
                            .Interior.Color = Sh.Cells(6, 12).Interior.Color
                            .Font.Color = Sh.Cells(6, 12).Font.Color
                            .Value = Sh.Cells(6, 12).Value
                        Case "U"
                            .Interior.Color = Sh.Cells(6, 15).Interior.Color
                            .Font.Color = Sh.Cells(6, 15).Font.Color
                            .Value = Sh.Cells(6, 15).Value
                        Case "Z"
                            .Interior.Color = Sh.Cells(6, 18).Interior.Color
                            .Font.Color = Sh.Cells(6, 18).Font.Color
                            .Value = Sh.Cells(6, 18).Value
                        Case "B"
                            .Interior.Color = Sh.Cells(6, 21).Interior.Color
                            .Font.Color = Sh.Cells(6, 21).Font.Color
                            .Value = Sh.Cells(6, 21).Value
                        Case "L"
                            .Interior.Color = Sh.Cells(6, 24).Interior.Color
                            .Font.Color = Sh.Cells(6, 24).Font.Color
                            .Value = Sh.Cells(6, 24).Value
                        Case "SO"
                            .Interior.Color = Sh.Cells(6, 27).Interior.Color
                            .Font.Color = Sh.Cells(6, 27).Font.Color
                            .Value = Sh.Cells(6, 27).Value
                        Case Else
                            .Interior.ColorIndex = xlNone
                            .Font.ColorIndex = xlAutomatic
                            .NumberFormat = "General"
                    End Select
                End With
            Next RaZelle
        End If
        Set RaBereich = Nothing                         ' Variable leeren
    End If
End Sub

Gruß,


Ihre Antwort
  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen
Thema: Name: Email:



  • Bitte beschreiben Sie Ihr Problem möglichst ausführlich. (Wichtige Info z.B.: Office Version, Betriebssystem, Wo genau kommen Sie nicht weiter)
  • Bitte helfen Sie ebenfalls wenn Ihnen geholfen werden konnte und markieren Sie Ihre Anfrage als erledigt (Klick auf Häckchen)
  • Bei Crossposting, entsprechende Links auf andere Forenbeiträge beifügen / nachtragen
  • Codeschnipsel am besten über den Code-Button im Text-Editor einfügen
  • Die Angabe der Emailadresse ist freiwillig und wird nur verwendet, um Sie bei Antworten auf Ihren Beitrag zu benachrichtigen

Thema Datum  Von Nutzer Rating
Antwort
09.10.2016 21:00:32 Justin
NotSolved
10.10.2016 00:11:40 Gast81741
***
Solved
11.10.2016 17:01:14 Nobody
NotSolved
15.10.2016 16:50:02 Gast96938
NotSolved
15.10.2016 17:03:49 Gast55806
NotSolved
Blau VBA Code auf ganze Arbeitsmappe ausführen
15.10.2016 18:17:08 Gast11064
NotSolved
15.10.2016 19:49:48 Gast70117
NotSolved
15.10.2016 20:52:47 Gast3524
NotSolved
15.10.2016 21:17:29 Gast97459
NotSolved
16.10.2016 00:08:57 Justin
NotSolved
16.10.2016 01:34:46 Gast39271
*****
Solved
16.10.2016 11:54:05 Justin
Solved