Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
VBA 代码将执行以下操作。
if cell = MSD_CMT_CHANGE then compare cell above it if equal "MSD_CHANGE" then cell E1 = E2.
我有超过 5000 行数据。
检查下面的图片以获得更好的解释。
尝试这样的事情:
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