Sub RGB_颜色修改() Dim i As Long Dim lastRow As Long Dim rgbValues() As String Dim totalRgbValues As Long Dim currentRgbValues(3) As Long Dim k As Long ' Find the last row with data lastRow = ActiveSheet.Cells(Rows.Count, "A").End(xlUp).Row ' Go through each cell in column A For i = 1 To lastRow ' Assume the value in each cell is in the form "R1,G1,B1" rgbValues = Split(Cells(i, "A").Value, ",") totalRgbValues = UBound(rgbValues) + 1 ' +1 for the empty string at the end ' Check if the value has the expected form If totalRgbValues = 3 Then For k = 0 To totalRgbValues - 1 currentRgbValues(k) = CLng(rgbValues(k)) ' Convert to Long to handle possible large values If k = 2 Then ' We want to set the color only after the last value is read Cells(i, "A").Interior.Color = RGB(currentRgbValues(0), currentRgbValues(1), currentRgbValues(2)) End If Next k End If Next i End Sub