我跟着一些數組教程,但我的代碼在VBA中對我來說太難以將其轉換爲數組用於我的基本知識。如何更改我的代碼以獲取值到數組中
任何人都可以幫忙嗎?
這是我的代碼:
Sub InternExtern()
Dim source, addrescell, destination As Range
Dim Sourcevalue As String
For Each source In Range("E6", Range("E" & Rows.Count).End(xlUp))
If source.Value <> "" Then
For Each addrescell In Range("address_table_names").Rows
If addrescell.Cells(1).Value <> "" And InStr(source.Offset(0, 23).Value, "Extern") = 0 Then
SourceName = addrescell.Cells(1).Value
Sourcevalue = addrescell.Cells(1, 4).Value
If InStr(UCase(source), UCase(SourceName)) <> 0 Then
If InStr(Sourcevalue, "10.") <> 0 Or InStr(Sourcevalue, "192.168.") <> 0 Or IsInternal(addrescell.Offset(0, 3).Value) Then
source.Offset(0, 23) = "Intern"
Else: source.Offset(0, 23) = "Extern"
End If
End If
If InStr(source, "-ext-") <> 0 Or InStr(source, "any") <> 0 Or InStr(source, "-EXT-") <> 0 Then
source.Offset(0, 23) = "Extern"
End If
If InStr(source, "any") <> 0 And InStr(source.Offset(0, -1).Value, "FW-Peering") = 0 Then
source.Offset(0, 23) = "Intern"
End If
End If
Next addrescell
End If
Next source
我添加的列值到陣列的目標是,使其更快。
在此先感謝!
爲了使_what_更快,反正呢? – sehe 2013-03-15 12:37:56
您沒有正確聲明所有範圍變量。 'source'和'addrescell'是Variant,基於你設定尺寸的方式。 – 2013-03-15 13:45:45
您的[上一個問題](http://codereview.stackexchange.com/q/23923/2726)已被遷移到CR,並得到[Dick Kusleika](http://codereview.stackexchange.com/a/)的很好回答2726分之23956)。投票結束。 – 2013-03-15 18:38:25