尝试下面的简短代码,它在有限的数据记录下可以用于我的测试。让我知道它是否也适用于您的数据。
Sub UpdateVEPlanning()
Dim sht As Worksheet
Dim LastRow, lRow As Long
' modify "Sheet1" to whatever worksheet name you have
Set sht = ThisWorkbook.Worksheets("Sheet1")
' find last row in sheet with data
LastRow = sht.Cells(sht.Rows.Count, "A").End(xlUp).row
For lRow = 2 To LastRow
If sht.Cells(lRow, 1) = sht.Cells(lRow - 1, 1) Then
If Not (sht.Cells(lRow, 9).Find("SUDURA") Is Nothing) And (IsEmpty(sht.Cells(lRow, 4).Value2) Or sht.Cells(lRow, 4).Value2 <= 0) Then
If sht.Cells(lRow, 6) = sht.Cells(lRow - 1, 6) Then
sht.Cells(lRow, 5) = sht.Cells(lRow - 1, 5) + 10
End If
End If
End If
Next
End Sub
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句