I have arrays that I want to write from VBA to Excel. The Microsoft website gives advice and gives code similar to what's shown below (http://support.microsoft.com/default.aspx?scid=kb;en-us;306022).
My question relates to the following line:
DataArray(r, 11) = "=RC[+14]"
What this does is input a formula in column 11 from the same row but 14 columns to the right. * The cell contents in Excel have a formula in there, but what I need is a value. *
Any assistance would be appreciated.
Sub Update()
Dim DataArray(1 To 1000, 1 To 20) As Variant
Dim r As Integer
For r = 1 To 1000
DataArray(r, 1) = "ORD" & Format(r, "0000")
DataArray(r, 2) = Rnd() * 1000
DataArray(r, 3) = DataArray(r, 2) * 0.7
DataArray(r, 11) = "=RC[+14]"
Next
Sheets("Sheet1").Range("A1").Resize(1000, 20).Value = DataArray
End Sub
My question relates to the following line:
DataArray(r, 11) = "=RC[+14]"
What this does is input a formula in column 11 from the same row but 14 columns to the right. * The cell contents in Excel have a formula in there, but what I need is a value. *
Any assistance would be appreciated.
Sub Update()
Dim DataArray(1 To 1000, 1 To 20) As Variant
Dim r As Integer
For r = 1 To 1000
DataArray(r, 1) = "ORD" & Format(r, "0000")
DataArray(r, 2) = Rnd() * 1000
DataArray(r, 3) = DataArray(r, 2) * 0.7
DataArray(r, 11) = "=RC[+14]"
Next
Sheets("Sheet1").Range("A1").Resize(1000, 20).Value = DataArray
End Sub