excel编排不规则序号的问题
第二个编号用公式不好整,帮你写了一个宏,如附件所示,打开文件启用宏后,点里面的按钮试一下效果。
代码如下:
Option Explicit
Sub 自动填写户号()
Dim k As Range, strTeam$, int1%, int2%
With ActiveSheet
For Each k In 。 Range("C4:C" & 。[D65536]。End(xlUp)。Row)
If k Like "*组" Then
strTeam = Format(Left(k, Len(k) - 1), "00")
int2 = 0
Else
If Len(k) <> 0 Then
int1...全部
第二个编号用公式不好整,帮你写了一个宏,如附件所示,打开文件启用宏后,点里面的按钮试一下效果。
代码如下:
Option Explicit
Sub 自动填写户号()
Dim k As Range, strTeam$, int1%, int2%
With ActiveSheet
For Each k In 。
Range("C4:C" & 。[D65536]。End(xlUp)。Row)
If k Like "*组" Then
strTeam = Format(Left(k, Len(k) - 1), "00")
int2 = 0
Else
If Len(k) <> 0 Then
int1 = int1 + 1
int2 = int2 + 1
k。
Offset(0, -2)。NumberFormat = "@"
k。Offset(0, -1)。NumberFormat = "@"
k。Offset(0, -2) = Format(int1, "000")
k。
Offset(0, -1) = strTeam & Format(int2, "00")
End If
End If
Next
End With
End Sub。收起