0

I have a 1-dimensional array of numbers. I want to paste this into a new csv file. But the problem is that only the first value of the array is pasted.

After I collect the numbers into the array and create a new CSV file, this is the code I'm trying to use to paste the array:

FSO.CreateTextFile ("C:\users\lloyd\Coding\vbafolder\missingclose.csv")
Workbooks.Open ("C:\users\lloyd\Coding\vbafolder\missingclose.csv")

Range("a1").Select

Range("a1:a" & arraycount).Select
Selection.Value = noCloseArray

How can I paste my entire array into each cell of the spreadsheet?

lmac
  • 117
  • 8
  • Every time an item is added into the array, the arraycount is increased by 1 If there's 100 items in the array, then arraycount is 100). So the array count is as big as the array – lmac Jul 08 '22 at 20:02
  • arraycount is 820. The first value is a date, and the remaining 819 values are strings (not numbers, which I mistakenly claimed) – lmac Jul 08 '22 at 20:06
  • 1
    Try `Range("A1:A" & arraycount).Value = Application.Transpose(noCloseArray)`. – BigBen Jul 08 '22 at 20:07
  • 1
    1D arrays in VBA are horizontal. If your ultimate goal is to write to a sheet, it's better to use a 2D array. – BigBen Jul 08 '22 at 20:10

0 Answers0