compariniaa
07-19-2006, 01:34 PM
I have the following code to add a custom list:
Sub VBAX_Example()
Dim r As Long
Dim i As Long
Dim FileArray(240) As String
i = 0
For r = 2 To 241
i = i + 1
FileArray(i) = sheets("Sheet1").Cells(r, "O")
Next r
Application.AddCustomList ListArray:=FileArray
End Sub
However, when I try to run it, I get "Run-time error '1004': Method 'AddCustomList' of object '_Application' failed"
I have no idea why I'm getting that wrong. My code seems to be just like threads I found on this site and similar to Excel Help's example. Can anybody help me?
Sub VBAX_Example()
Dim r As Long
Dim i As Long
Dim FileArray(240) As String
i = 0
For r = 2 To 241
i = i + 1
FileArray(i) = sheets("Sheet1").Cells(r, "O")
Next r
Application.AddCustomList ListArray:=FileArray
End Sub
However, when I try to run it, I get "Run-time error '1004': Method 'AddCustomList' of object '_Application' failed"
I have no idea why I'm getting that wrong. My code seems to be just like threads I found on this site and similar to Excel Help's example. Can anybody help me?