Home » excel » Output VBA Array of Doubles to One Cell in Excel

Output VBA Array of Doubles to One Cell in Excel

Posted by: admin May 14, 2020 Leave a comment

Questions:

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)

How to&Answers:

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)), ";")