How to copy a text array to a series of cells in Excel

Posted by aSystemOverload on Stack Overflow See other posts from Stack Overflow or by aSystemOverload
Published on 2012-10-12T15:17:48Z Indexed on 2012/10/12 15:37 UTC
Read the original article Hit count: 188

Filed under:
|
|

I am dynamically creating a report, where I create a worksheet, bring in the records afresh. How can I easily type the field names and copy them to the cells. Without doing one cell per line, there are ~20 columns.

I tried:

dim fieldNames as variant
fieldNames = ("'DS Date', 'A', 'B', 'A','S ASD', 'S','D S','D S', 'S','D S', 'SD', 'S','D'")
Sheets("DATA").Range("C14:W14").Value = Application.WorksheetFunction.Transpose(fieldNames)

But it just posts the whole thing in each cell? Any ideas?

© Stack Overflow or respective owner

Related posts about excel

Related posts about excel-vba