Referencing formatted cell in text

claushojmark

New Member
Joined
Jul 9, 2012
Messages
3
I'm having an issue with a formatted cell. I am trying write som text in a cell and using a cell reference to put a value in the middle of a sentence. It looks like this

Cells(122, 1).FormulaR1C1 = "This is text " & Range("B98") & " this is more text."

when it returns the cell value I get the unformatted version such as 5.0836272838939 instead of just 5.1. I tried to add .numberformat = "0.0" but it does not work. Any suggestions
?
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Welcome to the board.

If the cell B98 is already formatted as you desire, try

Cells(122, 1).FormulaR1C1 = "This is text " & Range("B98").Text & " this is more text."


If the cell B98 is NOT already formatted as you desire, try

Cells(122, 1).FormulaR1C1 = "This is text " & Format(Range("B98"),"0.0") & " this is more text."
 
Upvote 0

Forum statistics

Threads
1,215,228
Messages
6,123,747
Members
449,118
Latest member
kingjet

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top