Formatting in VBA
Hi Michael
Start the value with a single apostrophe to make
Excel treat the value as text:
Range("C" & 6 + y).Value = "'" & Format(BottomRange(y), "#,##0") & " - "
etc.
--
Best Regards
Leo Heuser
MVP Excel
Followup to newsgroup only, please.
"Michael J. Malinsky" skrev i en meddelelse
...
I have the following line of code:
Range("C" & 6 + y).Value = Format(BottomRange(y), "#,##0") & " - "
&
_
Format(TopRange(y), "#,##0")
BottomRange(0) = 1
TopRange(0) = 10
BottomRange(1) = 2
TopRange(1) = 11
So cell C6 should show 1-10 and C7 should show 2-11. Excel, in its
infinite
wisdom, automatically converts the result to a date format which shows as
10-Jan and 11-Feb, respectively. I want to keep the format function as
there are times when the amounts will be greater than those that would
generate this type of output. How can I get the output I want?
TIA
Mike
--
Michael J. Malinsky
|