Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays
Go Back  Xtreme Visual Basic Talk > > > Putting cell values from excel columns into multiple arrays


Reply
 
Thread Tools Display Modes
  #1  
Old 02-06-2014, 09:58 PM
bellaelysium bellaelysium is offline
Regular
 
Join Date: Jun 2008
Posts: 91
Question Putting cell values from excel columns into multiple arrays


Hi, I hope you can give me some guidance.

I am dealing with the data in excel using VS. Currently, I have problem trying to put my column data (starting from D column to x columns that user specified in textbox) into different arrays as I want to manipulate them individually.

Right now, my code output is that the values from D column is being displayed in rows instead of columns and the E column continue thereafter (in listview).

The reason for putting them in arrays because I am dealing with large amounts of data and copying to new excel workbook slow everything down. So I figure I'll put them in arrays. In addition, is it possible to apply excel formula (INDIRECT forumla) while they are in arrays before pasting the final calculated values in new excel workbook?


PS: I insert listviewbox just for checking purpose to see if values are displayed correctly.

Code:
 
   
       
'select column one by one using for loop (D to x column) to paste into different workbooks
        
Dim lastcell, firstcell, entireColumn, arrayrange As Excel.Range     
Dim colNum As Integer        
Dim i AsInteger

        colNum = TextBox1.Text + 3
         
For i = 4 To colNum
             firstcell = WSheet.Cells(2, i)
             lastcell = firstcell.End(Excel.XlDirection.xlDown)
             entireColumn = WSheet.Range(firstcell, lastcell)
             arrayrange = entireColumn

             'put the entire column values into array
Dim myArray AsObject(,) '<-- declared as 2D Array  
            myArray = arrayrange.Value    

'store the content of each cell 

For r AsInteger = 1 To myArray.GetUpperBound(0)
For c AsInteger = 1 To myArray.GetUpperBound(1)
                
Dim myValue AsObject = myArray(r, c)
                    ListView1.Items.Add(myValue.ToString)
                 
Next c
           
Next r
           
Continue For
Next
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays
 
Putting cell values from excel columns into multiple arrays
Putting cell values from excel columns into multiple arrays
 
-->