Advertisement

01.07.2008 at 11:52PM PST, ID: 23065846
[x]
Attachment Details

Excel Multicolumn ListBox

Asked by hiteshgoldeneye in Microsoft Excel Spreadsheet Software

Tags: list, add, listbox, multicolumn

Hi guys,

I need a fast method of loading a multicolumn listbox using lines in a text file.

Here is the code i am using
FF = FreeFile
    If Dir(ThisWorkbook.Path & "\abc.txt") <> "" Then
        Open ThisWorkbook.Path & "\abc.txt" For Input As #FF
        Do While (EOF(FF) = False)
            Line Input #FF, str1
           
            If Mid(str1, 9, 1) = "D" Then
               
                With lstExisting
                    .AddItem Mid(str1, 1, 3) ' add a new row
                    .List(i - 1, 0) = Mid(str1, 1, 3)
                    .List(i - 1, 1) = Mid(str1, 4, 4)
                    .List(i - 1, 2) = Mid(str1, 9, 4)
                    .List(i - 1, 3) = Mid(str1, 10, 3)
                    .List(i - 1, 4) = Mid(str1, 53, 5)
                    .List(i - 1, 5) = Mid(str1, 13, 40)
                End With
                i = i + 1
            End If
        Loop
        Close #FF

Is there a better way?Start Free Trial
[+][-]01.08.2008 at 12:07AM PST, ID: 20606734

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]01.08.2008 at 03:44AM PST, ID: 20607629

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Microsoft Excel Spreadsheet Software
Tags: list, add, listbox, multicolumn
Sign Up Now!
Solution Provided By: rorya
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628