LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Entering data into arrays

Folks,

I have a set of data like this:

1 Dave
3 Matt
2 Bill
4 Steve

I wanted to enter this data into an array, and assign it an address within
that array based on the number associated with each name. Hence 1 = Dave, 2 =
Bill etc. However the output seems to miss out the second data point. You end
up with:

1 Dave
2
3 Matt
4 Steve

Does data-entry into an array in VBA have to be sequential? The code I was
using was:

Sub test()
Dim testname(4)

For i = 1 To 4

testname(Cells(i, 1).Value) = Cells(i, 2).Value
Cells(i, 3).Value = testname(i)

Next i

End Sub

With the data in columns A and B in the spreadsheet. Appreciate it if
someone can spot the problem.

Cheers,

Matt

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
transfering data in another column entering more sorted data Kevin - Corporate Services Excel Worksheet Functions 0 August 6th 08 09:23 PM
Reading data arrays from multiple data files in excel Hankjam[_2_] Excel Discussion (Misc queries) 0 February 7th 08 08:29 PM
Data Access Efficiency: Arrays versus Worksheet Data Neal Zimm Excel Programming 2 October 2nd 06 08:39 PM
Working with ranges in arrays... or an introduction to arrays Glen Excel Programming 5 September 10th 06 08:32 AM
Arrays - declaration, adding values to arrays and calculation Maxi[_2_] Excel Programming 1 August 17th 06 04:13 PM


All times are GMT +1. The time now is 12:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"