View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.misc
Allllen Allllen is offline
external usenet poster
 
Posts: 341
Default 2-dimensional array to 2 column list

Here is some VBA to do this for you

things to do first:

1) get your data on a sheet so that there is nothing else, and the sheet
looks exactly like you had it in the mail. So cell A1 is empty, the first
row has your .01 etc and the first column has the mail numbers, the rest is
data in the middle, and there is nothing else on the sheet.

2) create a new blank sheet in the same workbook and call it "ouput"

3) use this code in a module. See here for instructions (regular module)
http://www.contextures.com/xlvba01.html

4) go into your first sheet with the data, and do tools, macros and run the
one called hello.

*****************
Sub hello()

Dim x, y, z As Integer
x = 2: y = 2: z = 1

Do Until IsEmpty(Cells(x, 1))
Do Until IsEmpty(Cells(1, y))
Sheets("output").Cells(z, 1).Value = Cells(x, 1).Value + Cells(1,
y).Value
Sheets("output").Cells(z, 2).Value = Cells(x, y).Value
z = z + 1
y = y + 1
Loop
y = 2
x = x + 1
Loop

End Sub

************
--
Allllen


"TDS" wrote:

I have data like this:
.01 .02 .03 .04 .05 .06 .07 .08 .09
1.0 2.0 2.15 2.3 2.7 3.0 3.26 3.40 3.61 3.89
1.1 3.94
1.2
1.3
1.4
1.5
Etc... this is a basic table to figure the greater number (1st column) +
the lesser number (the 1st row) ...the find the array value @ A3:C3. I need
to convert this a 2-column file such as:

1.01 2.0
1.02 2.15
1.03 2.3
1.04 2.7
1.05 3.0
etc.

Hope this is enough info...

Basically it is an array for figuring flow of water...if I know how high the
creek is flowing, I can figure how many cfs it is passing. So, if I know
it's 2.45 ft...then the table would figure xx.xxx cfs. But in order to bring
it into another program I have to have it in a 2-column list.

Thanks!