I really dont like dealing with arrays when list is available.
http://www.dotnetperls.com/list-vbnetCode:Dim OverallValueList As New List(Of List(Of String)) Dim xlapp As New Excel.Application xlapp.Workbooks.Add() Dim Wsheet As Excel.Worksheet xlapp.Visible = True Wsheet = xlapp.ActiveSheet Dim colNum As Integer = TextBox1.Text + 3 For i As Integer = 4 To colNum Dim LastRow = Wsheet.Cells(Wsheet.Rows.Count, i).End(Excel.XlDirection.xlUp).Row If LastRow >= 2 Then Dim ColValuesList As New List(Of String) For c = 2 To LastRow ColValuesList.Add(Wsheet.Cells(c, i).value) Next c OverallValueList.Add(ColValuesList) End If Next i For Each columnValueList In OverallValueList For Each value In columnValueList MessageBox.Show("this is value item from column: " & value) Next value MessageBox.Show("move to next column value list") Next columnValueList
If you want to enable editing, perhaps you should add the values to a datagridview instead?




Reply With Quote
