Tidoni
Tidoni

Reputation: 369

Output VBA Array of Doubles to One Cell in Excel

I am trying to dump the content of an array of Doubles into a single Cell in Excel with VBA.

I found an Answer, which solves the problem for Strings or Variant, but not for Double.

Dim arr(1 To 3) As Double
arr(1) = 0.81
arr(2) = 0.95
arr(3) = 1.74

Worksheets("Test").Cells(1,1).Value = dump(arr, ";")

The Last line should write all the values from the Array to the Cell specified.

Edit: Changed 0,81 to 0.81 etc. (German System vs. International Standard)

Upvotes: 1

Views: 1003

Answers (1)

EvR
EvR

Reputation: 3498

It will be a string anyway, looping or transposing or Use of Index(nice omegastripes): (plus change the , to .)

Dim arr(1 To 3) As Double
arr(1) = 0.81
arr(2) = 0.95
arr(3) = 0.74

Worksheets("Test").Cells(1, 1).Value = Join(Application.Transpose(Application.Transpose(arr)), ";")

Upvotes: 2

Related Questions