level 1
vikerr
楼主

用了以下VBA代码 但运行无反应:Sub FillColumnBWithUniqueRedFontCell()
Dim ws As Worksheet
Dim cell As Range
Dim currentRow As Long
Dim lastRow As Long
Dim redFontColor As Long
Set ws = ThisWorkbook.Sheets("sheet1")
redFontColor = RGB(255, 0, 0)
lastRow = ws.Cells(ws.Rows.Count, "D").End(xlUp).row
For currentRow = 2 To lastRow
For Each cell In ws.Range(ws.Cells(currentRow, "E"), ws.Cells(currentRow, "J"))
If cell.Font.Color = redFontColor Then
ws.Cells(currentRow, "B").Value = cell.Value
Exit For
End If
Next cell
Next currentRow
End Sub