1
任何人都可以請解釋什麼是這個錯誤的原因?代碼對我來說看起來非常好。編譯錯誤:預期的數組 - VBA
Public n As Long, i As Long, prodCode As String
Private Sub newArray()
n = wsProducts.Range("A1", wsProducts.Range("A1").End(xlDown)).Rows.Count
ReDim prodCode(n)
For i = 1 To n
prodCode(i) = wsProducts.Range("A1").Offset(i, 0)
Next i
End Sub
您已經將'prodCode'聲明爲一個字符串,但不是一個字符串數組 – YowE3K
'prodCode()As String' –
@ YowE3K謝謝!那太簡單了! –