下面的代碼完美地工作2003的excel下,但在2010年返回錯誤 '類型不匹配13' 在以下行 「如果ARRAY2(1,i)的<> 0,則」類型不匹配13 2010
任何有什麼想法如何解決這個問題?
提前THX
桑尼
她是代碼:
Sub BerekenGepresteerdeUrenVoorEenMaand(SheetNaam As String)
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Dim Array1 As Variant
Dim Array2 As Variant
Dim Range1 As Range
Dim Range2 As Range
Dim RangeTarget1 As Range
Dim RangeTarget2 As Range
Dim mRange As Excel.Range
Dim RangeNieuwSaldo As Range
Dim i As Integer
Dim j As Integer
Dim k As Integer
Dim l As Integer
Dim subTotaal As Double
ActiveWorkbook.Worksheets(SheetNaam).Activate
Set Range1 = ActiveSheet.Range("EersteRij")
Set Range2 = ActiveSheet.Range("LaatsteRij")
Set RangeTarget1 = ActiveSheet.Range("NaamVeld")
Set RangeTarget2 = ActiveSheet.Range("SaldiVeld")
Array1 = Range1.Value
Array2 = Range2.Value
RangeTarget1.Locked = False
RangeTarget2.Locked = False
j = 0
For i = LBound(Array1, 2) To UBound(Array1, 2)
If Array2(1, i) <> 0 Then 'Line generating error
j = j + 1
RangeTarget1.Cells(j, 1).Value = Array1(1, i)
RangeTarget2.Cells(j, 1).Value = Array2(1, i)
Else
End If
Next
For k = j + 1 To 11
RangeTarget1.Cells(k, 1).Value = ""
RangeTarget2.Cells(k, 1).Value = ""
Next
RangeTarget1.Locked = False
RangeTarget2.Locked = False
Erase Array1
Erase Array2
Set Range1 = Nothing
Set Range2 = Nothing
Set RangeTarget1 = Nothing
Set RangeTarget2 = Nothing
Application.EnableEvents = True
Application.ScreenUpdating = True
Application.DisplayAlerts = True
End Sub
變化'暗淡我作爲Interger'到'暗淡我作爲Integer' –
對不起,這是錄入錯誤複製代碼論壇 – user3220149
數組2 = Range2.Value時,確保區域2的東西@ user3220149 – Stephenloky