分享 | 可以自动着色的地图教程终于来了!

着色可以自由配置 可以根据省份来着色 可以根据数值大小来自由着色 VBA一键处理!


'公众号:Excel办公实战'作者:E精精'功能:地图着色'日期:20210507'------------------------------------------------Sub 地图作色() '省份所在列-可自由配置 Const strCol As String = "I" Dim i As LongWith Sheet1 maxRow = .Cells(Rows.Count, strCol).End(3).RowFor i = 2 To maxRow .Shapes(.Cells(i, strCol)).Fill.ForeColor.RGB = _ .Cells(i, Cells(1, strCol).Column + 2).Interior.ColorNextEnd WithEnd Sub
Sub 清除着色() Dim Sh As ShapeWith ActiveSheetFor Each Sh In .ShapesIf Sh.Type = MsoShapeType.msoFreeform Then Sh.Fill.ForeColor.RGB = RGB(255, 255, 255)End IfNextEnd With

'公众号:Excel办公实战'作者:E精精'功能:RGB地图着色'日期:20210507'------------------------------------------------Sub 地图作色RGB() '省份所在列-可自由配置 Const strCol As String = "I" Dim i As LongWith Worksheets("RGB着色") maxRow = .Cells(Rows.Count, strCol).End(3).Row
For i = 2 To maxRow arRGB = Split(.Cells(i, Cells(1, strCol).Column + 2), "|") .Shapes(.Cells(i, strCol)).Fill.ForeColor.RGB = _ VBA.RGB(arRGB(0), arRGB(1), arRGB(2))NextEnd WithEnd Sub 赞 (0)
