Hi,
How can I pass a variable holding a string date (YYYY-MM) to a cell without it calculating as 2012 minus 10 resulting in 2002
See screenshot
Any ideas...TX :)
Pass date to cell as string
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Pass date to cell as string
You do not have the required permissions to view the files attached to this post.
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78629
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Pass date to cell as string
Place quotes around the string value:
Code: Select all
... = "=INDIRECT(""B""&ROW())&"" ""&INDIRECT(""D""&ROW())&"" ""&""" & ShName & """"
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Pass date to cell as string
TX....it worked!!
I tried that but I must have got the quote count wrong??!!
Even tried:
- CStr(ShName)
- Str(ShName)
- Format(ShName,"@")
....
I tried that but I must have got the quote count wrong??!!
Even tried:
- CStr(ShName)
- Str(ShName)
- Format(ShName,"@")
....
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.
-
- Administrator
- Posts: 78629
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Pass date to cell as string
It doesn't matter whether you use CStr or Str or Format - without those quotes, the formula will end in
...&2012-10
which causes Excel to evaluate 2012-10 to 2002. Adding the quotes changes the formula to
...&"2012-10"
which appends the string "2012-10".
...&2012-10
which causes Excel to evaluate 2012-10 to 2002. Adding the quotes changes the formula to
...&"2012-10"
which appends the string "2012-10".
Best wishes,
Hans
Hans
-
- gamma jay
- Posts: 25455
- Joined: 17 Mar 2010, 17:33
- Location: Cape Town
Re: Pass date to cell as string
Cheers...TX for the help!
Regards,
Rudi
If your absence does not affect them, your presence didn't matter.
Rudi
If your absence does not affect them, your presence didn't matter.