鉴于您正在处理大量行,我首先建议您编写自己的宏而不是尝试记录一个宏。我将首先编写一个带有基本 For 循环的子例程,该循环访问您感兴趣的列中的每一行。
Dim i as long
Dim j as long
Dim finalRowEColumn as long
Dim finalRowDColumn as long
Dim eCellValue as string
finalRow = <Insert your final row here, or dynamically get it from your range of rows>
For i = 1 to finalRowEColumn
eCellValue = Range("E" & i).Value
For j = 1 to finalRowDColumn
dCellValue = Range("D" & j).Value
'This inner loop will allow you do perform comparisons with the values in each of the columns
'You may set cell formats, values, etc. Depending on your parameters eCellValue and dCellValue.
Next j
Next i
我希望这是一个好的开始。