简体   繁体   中英

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM