Gruppe
Allgemein
Problem
Auf Schaltflächenklick sollen die Artikel in Spalte A mit den in Tabelle Farbindex hinterlegten Hintergrundfarben versehen werden.
StandardModule: Modul1
Sub SetColors()
Dim wks As Worksheet
Dim vColor As Variant
Dim iRow As Integer, iRowL As Integer
Set wks = Worksheets("FarbIndex")
iRowL = Cells(Rows.Count, 1).End(xlUp).Row
For iRow = 1 To iRowL
vColor = Application.Match(Cells(iRow, 1).Value, wks.Columns(1), 0)
If Not IsError(vColor) Then
Cells(iRow, 1).Interior.ColorIndex = wks.Cells(vColor, 2).Value
End If
Next iRow
End Sub