Log in

View Full Version : Solved: Comma dissapears in bookmark



SilverSN95
08-05-2009, 01:01 PM
This is probably an easy fix, but I have spent some time on it and can't figure it out.
In my macro, I am performing the following line:

dest.Bookmarks("Premium").Range.Text = .Range("I40")

where I40 is a number like 1,300. The problem is when it is placed at the bookmark, I get 1300 with no comma.

I've tried wrapping the .range with int() and a couple other things to no avail.
Any help would be great.

Thanks.

Tommy
08-05-2009, 01:58 PM
dest.Bookmarks("Premium").Range.Text = Format(.Range("I40"), "###,###")

SilverSN95
08-06-2009, 06:36 AM
Thanks that fixed the problem.
Just out of curiosity, why is the comma getting dropped? I think even when I formatted it as text, it would still loose it.

Tommy
08-06-2009, 09:41 AM
The default of the Range class is value. The value is 1300 not 1,300. I could be wrong but if you format it as text and type in the comma it should not be dropped.

If you don't want to use the format statement you could do:

dest.Bookmarks("Premium").Range.Text = .Range("I40").Text