VBA代码将执行以下操作:
if cell = MSD_CMT_CHANGE then
compare cell above it if equal "MSD_CHANGE" then
cell E1 = E2.
我有超过5000行数据。
检查下面的图像以获得更好的解释。
答案 0 :(得分:2)
尝试这样的事情:
Sub Test
Dim rng as Range, cl as Range
Set rng = Range("D2:D" & Range("D" & Rows.Count).End(xlUp).Row)
For each cl in rng
If cl = "MSD_CMT_CHANGE" AND cl.Offset(-1, 0) = "MSD_CHANGE" Then
cl.Offset(-1, 1) = cl.Offset(0, 1)
End If
Next cl
End Sub