View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Jim Cone Jim Cone is offline
external usenet poster
 
Posts: 3,290
Default Delete custom lists


These two lines...
Application.DeleteCustomList
Application.GetCustomListNum(aryList)

Should be one line...
Application.DeleteCustomList Application.GetCustomListNum(aryList)
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware
(Excel Add-ins / Excel Programming)



"Hans Knudsen"

wrote in message
On 13 October 2006 Bob Phillips posted below code. I would like very much to
use this code but I cannot get it to work I get the error message: "Compile
error Argument not optional", and the text "DeleteCustomList" in the fifth
line from below is highlighted.

Sub DeleteLists()
Dim msg As String
Dim aryList
Dim i As Long, j As Long

For i = 1 To Application.CustomListCount
aryList = Application.GetCustomListContents(i)
msg = ""
For j = LBound(aryList) To UBound(aryList)
msg = msg & aryList(j) & vbNewLine
Next j
If MsgBox(msg & vbNewLine & vbNewLine & "Delete this list?",
vbYesNo) = vbYes Then
Application.DeleteCustomList
Application.GetCustomListNum(aryList)
End If
Next i
End Sub

Any help?
Hans Knudsen