RE: ActiveCell.Value copies unwanted currency format of source cel



Thanks JMB.

I just noticed something in my declaration of the variables but I'm not sure
if that was/is the reason. Please see my reply to JLGWhiz.


"JMB" wrote:

I cannot duplicate your problem then. When declared as variant, I get your
results. When declared double I get 6.6513 in cell I7 (although only 2
decimals may be displayed). Only other thing I can suggest is to double
check the spelling of your variable. for example:

Dim MyVariable as Double

MyVaraible = Activecell
Range("I7") = MyVaraible

If Option Explicit is not at the top of your module, XL will happily create
MyVaraible (and it will be a variant).


"Bluda" wrote:

Thanks JMB.

Sorry for not mentioning this information before but the Variable is
declared as a 'Double'.
I have looked through my entire code and verified that it's not a code
'misinterpretation'. I used the code sample in a different workbook and just
to make sure but I have received the same results. I have absolutely no clue
why this is happening.



"JMB" wrote:

Try declaring TestValue as a double. I don't know the details, but has
something to do w/Testvalue being a variant (currency subtype) which is the
default data type when you don't declare them.



"Bluda" wrote:

Hi Experts!
I'm confused by the way ActiveCell.Value works. Here is my problem:

I try to pull the value of a cell from a different work***. This
'source-cell' contains the value e.g. "6.6513" formatted as currency with two
decimal places "$6.65".

Source ***/Cell:
TestValue = ActiveCell.Value
Debug.Print TestValue (=shows 6.6513)

Destination ***/Cell:
Range("I17").Value = TestValue

The value shown in destination cell I17 now shows "$6.65" and its absolute
value is "6.65" the last two decimal places were not put in I17. The same
example with the source-cell being formatted as number with two decimal
places (instead of currency) shows also "6.65" in I17 but its absolute is
"6.6513"????

Does anyone have an explanation for me? I cannot see any logical reason
behind it...

Thank you,
Bluda
.