Label Captions

  • Thread starter Thread starter CrankyLemming
  • Start date Start date
C

CrankyLemming

Hi

I have a label on a form which is linked to a cell on a sheet as
follows:

Label1.Caption = Sheets("Income").Range("G11")

The problem I have is that the cell G11 is formatted for a money
figure. I have tried formatting the cell under Number, Accounting and
Currency, to two decimal places, but the figure that appears in the
label is wrong. EG, '9.00' in cell G11 reads as '9' in the Label. On
occasion the cell reads say 2.56, but the label 2.579. I can't see how
to put this right.

Please can anyone advise?

TIA

Steve
 
Hi Steve

You're paying the price for lazy programming. Serves you well <g>

Sheets("Income").Range("G11") What ?

is the clue here. That cell has lots of stuff. By not spesifying which one
you'll use, you'll get the default one, which is Value:

Sheets("Income").Range("G11").Value

What you want is the Text:

Sheets("Income").Range("G11").Text

HTH. Best wishes Harald
 
Harald said:
Hi Steve

You're paying the price for lazy programming. Serves you well <g>

Heh. You should see the rest of the code. 'Lazy' doesn't go far enough.
Sheets("Income").Range("G11") What ?

is the clue here. That cell has lots of stuff. By not spesifying which one
you'll use, you'll get the default one, which is Value:

Sheets("Income").Range("G11").Value

What you want is the Text:

Sheets("Income").Range("G11").Text

HTH. Best wishes Harald

That's spot on. Thanks a lot, Harald.

Steve
 
CrankyLemming said:
That's spot on. Thanks a lot, Harald.

You're welcome Steve. Note that Text returns #### from too narrow columns,
so make sure you have enough room.

Best wishes Harald
 

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