Page 1 of 1

[Solved] Write cell as string turns date to string

PostPosted: Sun Jan 20, 2019 1:19 am
by MaxG
I am reading a line of text delimited by tabs inot an array, which I write to a row in a spreadsheet.
The data starts with a date and the rest of the fields are numbers... like so:
Code: Select all   Expand viewCollapse view
19/01/2019   51.1   26.43   10.28


When I write the cell as number only the day (19) is placed in the cell.
When I write the call as String, the date is written as string ('19/01/2019) and not as date.
Code: Select all   Expand viewCollapse view
    ' loop through text line array
    If i <> 0 then
      ' write all cells as number
      cell.Value = arrCurrentLine(i)
    Else
      ' write first cell as String
      cell.String = arrCurrentLine(i)
    End If


I could not find a date type for a cell.
How can I write the date as a date to the cell?
Any hints appreciated.

Re: write cell as string turns date to string

PostPosted: Sun Jan 20, 2019 1:37 am
by Villeroy

Re: write cell as string turns date to string

PostPosted: Sun Jan 20, 2019 1:45 am
by MaxG
Thanks @Villeroy... further digging also revealed one of your posts:
Re: Setting date from macro to cell