Vielen Dank für die ausführliche Hilfe! Das _Change-Ereignis muss nur auf ein Tabellenblatt ausgeführt werden.
Leider klappt es trotzdem nicht, denn sobald ich den Prozedurkopf im allgemeinen Makro ändere zu "Sub Makro_1(ByRef wks As Excel.Worksheet)"
und With wks + End With hinzufüge, lässt sich das Makro nicht mehr ausführen. Ohne die beschriebenen Ergänzungen läuft das Makro. Hier ist das Makro:
Sub Makro_1(ByRef wks As Excel.Worksheet)
With wks
Dim c As Excel.Range
For Each c In Range(Cells(4, 4), Cells(250, 67))
Debug.Print c.Row
Debug.Print c.Column
If Not Cells(c.Row, c.Column).Value = vbNullString Then
Cells(c.Row, 2) = Cells(c.Row, c.Column).Interior.ColorIndex
End If
If Cells(c.Row, 2) = 45 Then
Cells(c.Row, 2) = "IT-Infrastructure"
End If
If Cells(c.Row, 2) = 33 Then
Cells(c.Row, 2) = "AGV"
End If
If Cells(c.Row, 2) = 6 Then
Cells(c.Row, 2) = "Advanced Automation"
End If
If Cells(c.Row, 2) = 14 Then
Cells(c.Row, 2) = "Wiritec"
End If
If Cells(c.Row, 2) = 3 Then
Cells(c.Row, 2) = "Smart Equipment"
End If
If Cells(c.Row, 2) = 47 Then
Cells(c.Row, 2) = "AI, machine learning"
End If
If Cells(c.Row, 2) = 40 Then
Cells(c.Row, 2) = "Others"
End If
Next
End With
End Sub
|