Option Explicit
Sub Demo()
Dim i As Long, j As Long
Dim arrData, rngData As Range
Const KEY_ACT = "Curling"
' Load data
Set rngData = ActiveSheet.Range("A1").CurrentRegion
arrData = rngData.Value
' Loop through each row
For i = UBound(arrData) - 1 To LBound(arrData) + 1 Step -1
' Compare Activtiy
If StrComp(arrData(i, 1), KEY_ACT, vbTextCompare) = 0 Then
' Compare Order
If StrComp(arrData(i, 2), arrData(i + 1, 2), vbTextCompare) = 0 Then
' Populate Seq
If Len(Trim(arrData(i, 3))) = 0 And Len(Trim(arrData(i + 1, 3))) > 0 Then
arrData(i, 3) = arrData(i + 1, 3)
End If
End If
End If
Next i
' Update table
rngData.Value = arrData
End Sub
1条答案
按热度按时间pobjuy321#
字符串
的数据