|
代码如下,请问在 thisworkbook 中如何自动先运行 sub abc 后运行 sub abc1 ?
Sub abc()
arr = [c1].CurrentRegion
On Error Resume Next
For i = 2 To UBound(arr)
If Sheets(arr(i, 3)) Is Nothing Then
Sheets.Add(after:=Sheets(Sheets.Count)).Name = arr(i, 3)
End If
Next
End Sub
Sub abc1()
arr = [a1:u999]
For Each sht In Sheets
If sht.Name <> "???" Then
r = 2
With sht
For i = 1 To 999
If arr(i, 3) = sht.Name Then
Application.Goto Reference:="R2C1:R500C1"
Selection.FormulaR1C1 = "=IF(RC2="""","""",COUNTA(R2C2:RC2))"
Sheets("???").Range(Cells(1, "A"), Cells(1, "U")).Copy .Cells(1, 1)
Sheets("???").Range(Cells(i, "A"), Cells(i, "U")).Copy .Cells(r, 1)
r = r + 1
End If
Next
End With
End If
Next
End Sub
|
|