Hi all,
I have a bit of code that looks in a cell for a date and time which looks like this.
Which works fine.
sdt now shows as ": sdt : #24/12/2021 06:30:00# : Date" in the immediate window. So far so good.
sdt is then placed in A4 where it displays as "24/12/2021 06:30:00"
I have some later code that looks for a match for sdt in A:A (I know this sounds weird but its just for the example) which throws an error because it cannot find a match.
Why?
Well, if you look closely... closlier... that's right. For some reason A4, despite being the value of sdt, has an extra space between the date and the time when it appears in the cell but not when its a variable.
Anyone know why the heck it is doing this?
To be fair, the source K1 also has an extra space too (can't be helped, the source is drawn from a report generated elsewhere) - but why does the extra space disappear and then reappear like this?
I suppose a bit of code would be possible to remove the extra space from the source.
But I'm mostly just puzzled about why the space only reappears on the page and not in the variable in my code
Thanks!
I have a bit of code that looks in a cell for a date and time which looks like this.
VBA Code:
Dim sdt As Date
sdt = ThisWorksheet.range("K1")
Which works fine.
sdt now shows as ": sdt : #24/12/2021 06:30:00# : Date" in the immediate window. So far so good.
sdt is then placed in A4 where it displays as "24/12/2021 06:30:00"
I have some later code that looks for a match for sdt in A:A (I know this sounds weird but its just for the example) which throws an error because it cannot find a match.
Why?
Well, if you look closely... closlier... that's right. For some reason A4, despite being the value of sdt, has an extra space between the date and the time when it appears in the cell but not when its a variable.
Anyone know why the heck it is doing this?
To be fair, the source K1 also has an extra space too (can't be helped, the source is drawn from a report generated elsewhere) - but why does the extra space disappear and then reappear like this?
I suppose a bit of code would be possible to remove the extra space from the source.
But I'm mostly just puzzled about why the space only reappears on the page and not in the variable in my code
Thanks!