つらつら Excel VBA

私の備忘録です。

2022-03-09から1日間の記事一覧

色からRGB値を算出

Sub セルの背景色をRGBで取得() 'セルの背景色を取得 Dim iColor As Long iColor = ActiveCell.Interior.Color '算出 Dim iR As Long, iG As Long, iB As Long iR = iColor Mod 256 iG = Int(iColor / 256) Mod 256 iB = Int(iColor / 256 / 256) Debug.Prin…

1,600万色を56色に減色する

とりあえずセルの背景色を減色した。深く考えない! Sub カラーインデックス56色に書き換え() Dim r As Range For Each r In ThisWorkbook.ActiveSheet.UsedRange With r.Interior If .ColorIndex <> xlNone Then .ColorIndex = .ColorIndex End If End With…