SeniorNewbie
Board Regular
- Joined
- Jul 9, 2023
- Messages
- 77
- Office Version
- 2021
- 2019
- Platform
- Windows
- MacOS
Hi out there,
my target is to construct a code line by loop through an array with the values of iR,iG. iB. All my attempts end in Type mismatch, No such Property or similar errors.
The following code show my attempts:
To test the code the corresponding two lines have to be activated.
Any idea what's my mistake?
THX in advance
Senior Newbie
my target is to construct a code line by loop through an array with the values of iR,iG. iB. All my attempts end in Type mismatch, No such Property or similar errors.
The following code show my attempts:
VBA Code:
Sub Colors()
Dim aColors, i As Integer, sParam As String
'aColors = Array("255, 0, 0", "255, 100, 100") 'for line 55
'aColors = Array("RGB(255, 0, 0)", "RGB(255, 100, 100)") 'for line 56
'aColors = Array(" = RGB(255, 0, 0)", " = RGB(255, 100, 100)") 'for line 57
For i = 0 To UBound(aColors)
With ActiveSheet
sParam = aColors(i)
'.Cells(i + 1, 1).Interior.Color = RGB(aColors(i))
'.Cells(i + 1, 1).Interior.Color = sParam
'.Cells(i + 1, 1).Interior.Color sParam
End With
Next i
End Sub
Any idea what's my mistake?
THX in advance
Senior Newbie