Hello PcMax
I do not fully understand your question.
I am not sure if I know what you are asking
( I do not have any knowledge of cell formatting )
But this may be some help
If you run this code, ( applied to the active worksheet )
Code:Dim DateBit As String Let DateBit = Now 'Typical Format "26.01.2018 08:48:05" Let DateBit = Format(DateBit, "dd") 'Typical Format "26" Range("A10").Value = " ""26"" " Range("A11").Value = " """ & DateBit & """ "
This should be the result:
Using Excel 2007 32 bit
Row\Col A 10xxxxxxxxxx"26"xxxxx 11xxxxxxxxxx"26"xxxxx
To Explain , If _ VariableWith26InIt = 26 _ then once you are within a string written in VBA, then to get a 26 within that string at any point you may write
either
____26
or
____" & VariableWith26InIt & "
_ " & _ closes the string and connects you to the VBA varable
_ & " _ connects to and brings you back into the string
_ VariableWith26InIt _ is a variable with _ 26 _ in it
_ Two quotes within a string , like _ "" _ is more difficult to understand, and nobody does as far as I am aware. My guess is that more by accident than design you have some simultaneous going in and out of a string at zero length when a _ “” _ is seen within a string and VBA internally “throws up” a single character _ “ _ and / or its syntax requirement of a matching pair is still satisfied to prevent a syntax error by a total string of this form:
“____””____” I do not believe anyone fully understands what is going on here
Alan




Reply With Quote
Bookmarks