EnergyAmber
New Member
- Joined
- Jul 1, 2022
- Messages
- 1
- Office Version
- 365
- Platform
- Windows
Hello. I have a problem when I am trying to information from Excel cells into the array consisting from this kind of info. All this format is text.
The code related to arrays looks like that (not the whole code) I have defined the arrays as a String and I just transfer the same content.
Even though I look the assigned parameter values, which are correct, it assigns the cells values like that while using formatting Range("A2:C290").NumberFormat = "@"
It gives those values. Why does it paste the time 00:00:00 in every cell, when it has to have a 5-minute difference? dt_time values inside the array are correct.
The code related to arrays looks like that (not the whole code) I have defined the arrays as a String and I just transfer the same content.
VBA Code:
Dim dt_array(), dt_date(1 To 289), dt_time(1 To 289) As String
dt_array = Workbooks("Smacro.xlsm").Worksheets("Sheet1").Range("A2:A290").Value
Workbooks("Smacro.xlsm").worksheets("Sheet2").Range("A2:A290") = dt_array()
For i = 1 To 289
'dt_date(i) = dt_array(i, 1)
dt_date(i) = Left(dt_array(i, 1), 10)
dt_time(i) = Right(dt_array(i, 1), 8)
Next i
Dim Destination1, Destination2 As Range
Set Destination1 = Workbooks("Smacro.xlsm").Worksheets("Sheet2").Range("B2")
Destination1.Resize(UBound(dt_date, 1)).Value = dt_date
Set Destination2 = Workbooks("Smacro.xlsm").Worksheets("Sheet2").Range("C2")
Destination2.Resize(UBound(dt_time, 1)).Value = dt_time
Even though I look the assigned parameter values, which are correct, it assigns the cells values like that while using formatting Range("A2:C290").NumberFormat = "@"
It gives those values. Why does it paste the time 00:00:00 in every cell, when it has to have a 5-minute difference? dt_time values inside the array are correct.