|
-
Aug 4th, 2011, 10:31 AM
#1
Thread Starter
New Member
Array to Excel
Hello all. I just have a quick question. I have an array that looks like this:
Dim x() As Integer= {20, 35, 50, 15, 75, 30, 55, 62.5, 15, 40, 40, 62.5, 35, 45, 50, 32.5, 42.5, 20, 47.5, 27.5, 60, 35, 75, 30, 45, 37.5, 25, 37.5, 30, 45}
I would like for each value of the array to be in its own cell in Microsoft Excel, with the first value, 20, in cell E2, and the final value, 45, in cell E31. How would I go about doing this. I thought that I could do this:
xSheet.Columns("E2:E31") = {20, 35, 50, 15, 75, 30, 55, 62.5, 15, 40, 40, 62.5, 35, 45, 50, 32.5, 42.5, 20, 47.5, 27.5, 60, 35, 75, 30, 45, 37.5, 25, 37.5, 30, 45}
But I get an error message each time, so it is probably wrong.
I have been successful in filling the first 4 columns of the spreadsheet with other arrays, but this is the first array in it that is using values a define before the program begins.
-
Aug 4th, 2011, 10:44 AM
#2
Re: Array to Excel
that array isn't integer()
Code:
Dim x() As Integer= {20, 35, 50, 15, 75, 30, 55, 62.5, 15, 40, 40, 62.5, 35, 45, 50, 32.5, 42.5, 20, 47.5, 27.5, 60, 35, 75, 30, 45, 37.5, 25, 37.5, 30, 45}
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Aug 4th, 2011, 10:46 AM
#3
Thread Starter
New Member
Re: Array to Excel
So, it should be Decimal right?
Also, I have another question. I don't know if you know, but do you know how to (you know) graph a curve of best fit on Excel, like a line of best fit, but a curve, preferably a logarithmic curve?
Last edited by rbrtadlsn; Aug 4th, 2011 at 10:50 AM.
-
Aug 4th, 2011, 10:55 AM
#4
Re: Array to Excel
try this:
vb Code:
Dim x() As Double = {20, 35, 50, 15, 75, 30, 55, 62.5, 15, 40, 40, 62.5, 35, 45, 50, 32.5, 42.5, 20, 47.5, 27.5, 60, 35, 75, 30, 45, 37.5, 25, 37.5, 30, 45}
xlWorkSheet.Range("A1:A30").Value = xlApp.WorksheetFunction.Transpose(x)
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
-
Aug 4th, 2011, 10:57 AM
#5
Re: Array to Excel
 Originally Posted by rbrtadlsn
So, it should be Decimal right?
Also, I have another question. I don't know if you know, but do you know how to (you know) graph a curve of best fit on Excel, like a line of best fit, but a curve, preferably a logarithmic curve?
Double will work.
Can't help with the graph. Sorry.
- Coding Examples:
- Features:
- Online Games:
- Compiled Games:
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|