Problem with fraction showing up as date when copied

  • Thread starter Thread starter Zeroman
  • Start date Start date
Z

Zeroman

I am trying to copy a cell from one workbook to another.

I am trying to copy a bunch of number and in one case I copy 3/4 but
when it gets to the second workbook it comes out as Mar-4 (it's
assuming that I want a date). I tried to call the variable a string

ie. dim NUMBA as string

but for some reason it still comes out as Mar-4.

Thanks in advance for any help.

Zeroman
 
I assume that you are doing this in code. Since 3/4 is a native date format
you will have problems. Try to convert this to a number.

dim NUMBA as Variant

if instr("/", NUMBA) then
NUMBA = cdbl(left(numba, instr("/", NUMBA)-1) / right(numba, instr("/",
NUMBA)+1)
end if
 
Him Jim,

Thanks for replying. Yes I am trying to code this in VBA. I trie
what you said and it still comes out as Mar-4. The easiest way to fi
this is by selecting the cell before I copy to it and convert it unde
"format cells" to custom. But I want to find a way to code it becaus
the worksheet that I am copying the 3/4 to may not even exist
 
Perhaps something like a single apostrophe at the beginning will work.

NUMBA = "'" & NUMBA

Stev
 
Steve, great job. Thanks a lot, works like a charm.

Thanks to you as well Jim.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top