Hi, I'm having difficulty with excel's automatic recognition of cell formats.
I have a column imported from another source that are stored in 'general' format - numbers are stored as text, dates appear as 'dd/mm/yyyy.
I am assigning these values to another column in a separate sheet, however excel appears to automatically detect date data types incorrectly as mm/dd/yyyy.
This leads to issues with dates such 30/01/YYYY and therefore returns a numeric value.
'a' is the general variable, the cell it's assigned to has the auto-detection issue.
thanks for any help.
I have a column imported from another source that are stored in 'general' format - numbers are stored as text, dates appear as 'dd/mm/yyyy.
I am assigning these values to another column in a separate sheet, however excel appears to automatically detect date data types incorrectly as mm/dd/yyyy.
This leads to issues with dates such 30/01/YYYY and therefore returns a numeric value.
Code:
Dim a
For irow = 4 To LastRow
a = Cells(irow, 2).Value
For icol = 3 To LastColumn
If (Cells(irow, icol).Value > 0) Then
Cells(irow, icol).Value = a
End If
Next icol
Next irow
'a' is the general variable, the cell it's assigned to has the auto-detection issue.
thanks for any help.