You have declared prodCode as a string, but not as an array of strings.
You need to use prodCode() As String if you wish to use that variable as an array.
Note: You can also speed your code up by using a Variant array, which allows you then to "load" the array in one transfer operation:
Public n As Long, prodCode() As Variant
Private Sub newArray()
n = wsProducts.Range("A1", wsProducts.Range("A1").End(xlDown)).Rows.Count
'P.S. That statement would simplify to
'n = wsProducts.Range("A1").End(xlDown).Row
prodCode = Application.Transpose(wsProducts.Range("A1:A" & n)
End Sub
Application.Transpose has been used to change the shape of the array from being a 1 To n, 1 To 1 two-dimensional array to being a 1 To n one-dimensional array.
prodCodeas a string, but not an array of stringsprodCode() As StringprodCode() As Variant(or, in this case, even asprodCode As Variant) you can then get rid of theReDimstatement by replacing the loop withprodCode = Application.Transpose(wsProducts.Range("A1:A" & n))