ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Delete custom lists (https://www.excelbanter.com/excel-discussion-misc-queries/169842-delete-custom-lists.html)

Hans Knudsen[_2_]

Delete custom lists
 
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





Jim Cone

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





Hans Knudsen[_2_]

Delete custom lists
 
Thank you.


Jim Cone wrote:
These two lines...
Application.DeleteCustomList
Application.GetCustomListNum(aryList)

Should be one line...
Application.DeleteCustomList Application.GetCustomListNum(aryList)





All times are GMT +1. The time now is 06:23 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com