Question How do I save my data from 2 listboxes into Excel?

spinshift

New member
Joined
Oct 3, 2011
Messages
1
Programming Experience
1-3
Hello, I am currently working on a program to add sub-directories into a ListBox- lstSKU and the files under the selected lstSKU item is listed in the ListBox - lstMaterials.

I want to save the Items from lstSKU into Column A1-A# and in Column B1-B# I need the Materials

I am able to save all the SKUs into Column A, but when it comes to saving the multiple Materials under SKU item into Column B, I am having a bit of an issue.

Am I to use a Nested For Loop?

I am sure there an easy solution to my problem and I feel that at this point, I am over thinking the method. Any help is greatly appreciated! Thank you!

VB.NET:
lstMaterials.Items.Clear()
MsExcel.Workbooks.Add()

For Each lstItem As Object In lstSKU.Items
     MsExcel.Range("A" & i).Value = lstSKU.Items.Item(i).ToString
     i = i + 1
Next
MsExcel.Visible = True

materialslocator.jpg
 
Back
Top