只能靠猜了,当前工作表不同表格 如果是多工作表再加个for each sht in sheets就可以了 Option Explicit Sub 非空数据填写序号() Dim i, m, p(1) With ActiveSheet For Each i In .UsedRange If InStr(i.Value, "序号") Then p(0) = i.Row: p(1) = i.Column Exit For End If Next If p(0) = 0 Then Exit Sub Application.ScreenUpdating = False For i = p(0) + 1 To .Cells(Rows.Count, p(1) + 1).End(xlUp).Row If InStr(.Cells(i, p(1)).Value, "序号") = 0 Then If Len(.Cells(i, p(1) + 1).Value) Then m = m + 1 .Cells(i, p(1)) = m Else .Cells(i, p(1)) = Empty End If End If Next Application.ScreenUpdating = True End With End Sub