ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How do I delete custom lists (https://www.excelbanter.com/excel-discussion-misc-queries/114290-how-do-i-delete-custom-lists.html)

Terry_Dell

How do I delete custom lists
 
I have inadvertently created hundreds of Custom Lists, in excel. Can I delete
them without having to delete one by one.

Any one help please

Bob Phillips

How do I delete custom lists
 
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


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Terry_Dell" wrote in message
...
I have inadvertently created hundreds of Custom Lists, in excel. Can I

delete
them without having to delete one by one.

Any one help please




Terry_Dell

How do I delete custom lists
 
Thanks for the reply Bob, but not sure on how to start. Where do I start - in
excel or dos?
could you please guide me.

Thanks Terry

"Bob Phillips" wrote:

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


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Terry_Dell" wrote in message
...
I have inadvertently created hundreds of Custom Lists, in excel. Can I

delete
them without having to delete one by one.

Any one help please





Gord Dibben

How do I delete custom lists
 
Terry

If not familiar with VBA and macros, see David McRitchie's site for more on
"getting started".

http://www.mvps.org/dmcritchie/excel/getstarted.htm

In the meantime..........

First...create a backup copy of your original workbook.

To create a General Module, hit ALT + F11 to open the Visual Basic Editor.

Hit CRTL + R to open Project Explorer.

Find your workbook/project and select it.

Right-click and InsertModule. Paste the code in there. Save the
workbook and hit ALT + Q to return to your workbook.

Run the macro by going to ToolMacroMacros.

You can also assign this macro to a button or a shortcut key combo.


Gord Dibben MS Excel MVP

On Mon, 16 Oct 2006 03:44:01 -0700, Terry_Dell
wrote:

Thanks for the reply Bob, but not sure on how to start. Where do I start - in
excel or dos?
could you please guide me.

Thanks Terry

"Bob Phillips" wrote:

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


--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"Terry_Dell" wrote in message
...
I have inadvertently created hundreds of Custom Lists, in excel. Can I

delete
them without having to delete one by one.

Any one help please





Gord Dibben MS Excel MVP


All times are GMT +1. The time now is 01:29 PM.

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