Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inputting a column of data in excel to an array

Status
Not open for further replies.

brellis1

Programmer
May 22, 2003
9
PH
Sorry that I can't spell. Anyways, I have a table of data. I need to input this data into an array, manipulate this data. Then output this data to a spreadsheet. My problem is knowing how the best way to accomplish this currently I am doing this to input a column of data

Function GetData()

'Initializes variables
Number_Of_Entrees = 0
Mover = 0

'This loop loops through until there is no information provided
Do Until IsEmpty(Worksheets("force input").Cells(Number_Of_Entrees + 2, 2).Value)
Number_Of_Entrees = Number_Of_Entrees + 1
Loop

'Resizes the array
ReDim Acceleration_Of_Projectile(0 To (Number_Of_Entrees - 1))


'The following loop is used to input all the accelerations, sets the values in the arrray to the acceleration
Do Until IsEmpty(Worksheets("force input").Cells(Mover + 2, 2).Value)
Acceleration_Of_Projectile(Mover) = Worksheets("force input").Cells(Mover + 2, 2).Value
Mover = Mover + 1
Loop

GetData = Number_Of_Entrees 'Returns the number of data points

End Function

I was hoping there was an easier way to input all the data without two for loops for this takes lots time for a large spreadsheet
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top