PC Review


Reply
Thread Tools Rate Thread

Add multiple custom lists

 
 
Chet
Guest
Posts: n/a
 
      17th Oct 2008
I would like to add multiple custom lists taken from the
activeworkbook sheet1. Sheet1 would have n custom lists with each
list in a column starting in row 1. Each column will be a custom
list to be imported.

I'm not clear how to do this using the addcustomlist command. I have
some code but it's not working. (I think it's pretty far off from
working.)

sub AddMultipleLists()
NbrOfLists=4
For Index =1 to NbrOfLists
For i = Lbound(ListArray,1) to Ubound(ListArray,1)
Worksheets("sheet1").cells(i, ColIndex).Value =
ListArray(i)
application.addcustomlist Array(ListArray)
Next I
Next Index

Any ideas? Thx Chet

 
Reply With Quote
 
 
 
 
Dave Peterson
Guest
Posts: n/a
 
      17th Oct 2008
Maybe this saved post will help:

The first exports the lists to a new worksheet.

Then save the workbook and open it on a different pc.

The second imports those extracted lists into excel on the new pc.

Option Explicit
Sub ExtractCustomList()

Dim iCtr As Long
Dim myArray As Variant
Dim newWks As Worksheet

Set newWks = Worksheets.Add
newWks.Cells.NumberFormat = "@"

For iCtr = 5 To Application.CustomListCount
myArray = Application.GetCustomListContents(iCtr)
newWks.Cells(1, iCtr - 4) _
.Resize(UBound(myArray) - LBound(myArray) + 1).Value _
= Application.Transpose(myArray)
Next iCtr
End Sub
Sub ImportCustomList()

Dim iCol As Long
Dim wks As Worksheet
Dim myArray As Variant

Set wks = ActiveSheet

With wks
For iCol = 1 To .Cells(1, .Columns.Count).End(xlToLeft).Column
myArray = .Range(.Cells(1, iCol), _
.Cells(.Rows.Count, iCol).End(xlUp)).Value
Application.AddCustomList listArray:=myArray
Next iCol
End With
End Sub

Chet wrote:
>
> I would like to add multiple custom lists taken from the
> activeworkbook sheet1. Sheet1 would have n custom lists with each
> list in a column starting in row 1. Each column will be a custom
> list to be imported.
>
> I'm not clear how to do this using the addcustomlist command. I have
> some code but it's not working. (I think it's pretty far off from
> working.)
>
> sub AddMultipleLists()
> NbrOfLists=4
> For Index =1 to NbrOfLists
> For i = Lbound(ListArray,1) to Ubound(ListArray,1)
> Worksheets("sheet1").cells(i, ColIndex).Value =
> ListArray(i)
> application.addcustomlist Array(ListArray)
> Next I
> Next Index
>
> Any ideas? Thx Chet


--

Dave Peterson
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Drop down lists from multiple source lists RoofIL Microsoft Excel Worksheet Functions 3 18th Feb 2010 09:44 PM
custom lists and custom formulas? nameruc Microsoft Excel Misc 0 6th Dec 2006 04:18 PM
Multiple lists with repeated values for dependet drop down lists =?Utf-8?B?bWNtYW51c2I=?= Microsoft Excel Worksheet Functions 1 29th Sep 2006 12:13 AM
multiple dropdown lists = multiple data readers??? Andrew Kidd Microsoft ASP .NET 3 22nd Apr 2004 04:23 PM
Multiple custom contact lists in Outlook linda Microsoft Outlook Contacts 3 9th Feb 2004 08:07 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:02 AM.