我在清理一塊VBA時遇到了424錯誤。我沒有寫出所有這些,但似乎沒有任何理由讓這個錯誤出現。它的Excel的Mac所以當然不會切換斷點我 :( 任何想法將是非常有益無理由退回424錯誤
Sub Transform()
Dim ws As Worksheet
Dim i, j As Long
Dim fndList, rpcList, endlist As Variant
Dim LastRow As Long
Dim c As Range
Application.ScreenUpdating = False
fndList = Array("1","2","3")
endlist = Array("x","y","z")
rpcList = Array("a","b","c")
Set ws = ActiveWorkbook.Sheets("Sheet2")
LastRow = ws.Cells(Rows.Count, "A").End(xlUp).Row
With ws
Rows("1:1").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Rows("2:2").Select
Selection.Insert Shift:=xlDown, CopyOrigin:=xlFormatFromLeftOrAbove
Rows(1).Delete
Columns(2).EntireColumn.Delete
.Range("A1:P1") = endlist
.Range("A2:P2") = rpcList
For Each c In .Range("A4:A" & LastRow)
ActiveCell.Hyperlinks.Add Anchor:=cell, Address:="https://" & cell.Value
Next c
For Each c In .Range("B4:B" & LastRow)
ActiveCell.NumberFormat = "[$-409]d-mmm-yy;@"
Next c
For Each c In .Range("C4:C" & LastRow)
ActiveCell.NumberFormat = "[$-409]d-mmm-yy;@"
Next c
For Each c In .Range("G4:G" & LastRow)
ActiveCell.Hyperlinks.Add Anchor:=cell, Address:="https://tool" & cell.Value
Next c
Dim l As Integer
Dim larray(1 To 10) As Integer
Dim k As Integer
k = 1
For l = 3 To 600
If Cells(l, 2).Value > Cells(l, 3).Value Then
Cells(l, 2).ClearContents
Cells(l, 3).ClearContents
End If
Next l
Dim h As Integer
h = 1
Dim m As Integer
For m = 3 To 600
If Cells(m, 2) > Now() Then
Cells(m, 2).ClearContents
End If
If Cells(m, 3) > Now() Then
Cells(m, 3).ClearContents
End If
Next m
End With
End Sub
你有'ws'但是下面的'行()'沒有前導期,所以默認情況下它們會引用ActiveSheet –