-1
我已經使用下面的代碼完美工作,但我希望它顯示兩個或多個綠色(RGB(0,176,80))單元值在單獨的單元格中不同的列在同一行內,而不是在同一個單元格中與+號一起顯示?Excel VBA代碼編輯在單獨的列中顯示兩個或更多值
Option Explicit
Sub main()
Dim row As ListRow
Dim icol As Long
Dim formula As String
For Each row In ActiveSheet.ListObjects("MyTable").ListRows
formula = ""
For icol = 1 To row.Range.Count - 1
With row.Range(1, icol)
If .Interior.Color = RGB(0, 176, 80) Then formula = formula & .value & "+" '.Address(False, False)
End With
Next icol
If formula <> "" Then row.Range(1, icol).value = Left(formula, Len(formula) - 1)
Next row
End Sub
輝煌一如既往。完美工作。評論也很好建議。 –
不客氣 – user3598756