我在“9”以上的编码有麻烦。 Sub ColourStates() Dim intState As Integer Dim strStateName As String Dim intStateValue As Integer Dim intColourLookup As Integer Dim rngStates As Range Dim rngColours As Range Set rngStates = Range(ThisWorkbook.Names("STATES").RefersTo) Set rngColours = Range(ThisWorkbook.Names("STATE_COLOURS").RefersTo) With Worksheets("MainMap") For intState = 1 To rngStates.Rows.Count strStateName = rngStates.Cells(intState, 1).Text intStateValue = rngStates.Cells(intState, 2).Value ' single colour intColourLookup […]