ooitzechyi
10-04-2016, 09:32 PM
Hi,
I wish to get the color code of shape selected to be show in specify cell.
For eg:
color code of shape selected: RGB (R, G, B)
'I want the code to be show as
Cell (1,2) = R
Cell (1,3) = G
Cell (1,4) = B
I have my code as below but I got error#438: Object doesn't support this property or method
Dim LastRow As Long
Dim ws As Worksheet
Dim shp As Shape
Dim R As Integer
Dim G As Integer
Dim B As Integer
Set shpslt = Selection.ShapeRange()
Set colr = shpslt.Fill.ForeColor.RGB
R = colr Mod 256
G = (colr \ 256) Mod 256
B = (colr \ 256 \ 256) Mod 256
Set ws = Worksheets("Summary")
LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row + 1
Worksheets("Summary").Activate
ws.Range("C" & LastRow).Value = R
ws.Range("D" & LastRow).Value = G
ws.Range("E" & LastRow).Value = B
ws.Range("B" & LastRow).Select
With Selection.Interior
.Color = RGB(R, G, B)
End With
I wish to get the color code of shape selected to be show in specify cell.
For eg:
color code of shape selected: RGB (R, G, B)
'I want the code to be show as
Cell (1,2) = R
Cell (1,3) = G
Cell (1,4) = B
I have my code as below but I got error#438: Object doesn't support this property or method
Dim LastRow As Long
Dim ws As Worksheet
Dim shp As Shape
Dim R As Integer
Dim G As Integer
Dim B As Integer
Set shpslt = Selection.ShapeRange()
Set colr = shpslt.Fill.ForeColor.RGB
R = colr Mod 256
G = (colr \ 256) Mod 256
B = (colr \ 256 \ 256) Mod 256
Set ws = Worksheets("Summary")
LastRow = ws.Range("A" & Rows.Count).End(xlUp).Row + 1
Worksheets("Summary").Activate
ws.Range("C" & LastRow).Value = R
ws.Range("D" & LastRow).Value = G
ws.Range("E" & LastRow).Value = B
ws.Range("B" & LastRow).Select
With Selection.Interior
.Color = RGB(R, G, B)
End With