遍历一下
DataTables("表A").ReplaceFor("工序号", "")
Tables("表A").Filter = "工序 is not null and 工序<>''"
Tables("表A").Rows(0)("工序号") = "01"
For i As Integer = 1 To Tables("表A").Rows.count - 1
Dim 工序号 As String = ""
If Tables("表A").Rows(i)("工序号") = Tables("表A").Rows(i - 1)("工序号") Then
工序号 = Tables("表A").Rows(i - 1)("工序号")
Else
Dim 最大值 As Integer = Tables("表A").Rows.Select(Function(行) val(行("工序号"))).max
工序号 = format(最大值 + 1, "00")
End If
Tables("表A").Rows(i)("工序号") = 工序号
Next
[此贴子已经被作者于2024/11/12 16:44:21编辑过]