ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Get Displayed Value Of a Cell (https://www.excelbanter.com/excel-programming/326448-get-displayed-value-cell.html)

MDW

Get Displayed Value Of a Cell
 
I'm trying to write a function that does the same thing as the "precision as
displayed" setting, but only for a certain range (the selected cells). Is
there any way to get at the displayed value of a cell? I think that will help
me accomplish what I want.

For instance, if the ACTUAL value of a cell is 76.5, but it's showing 77 on
the worksheet, I want to make the value of that cell 77.

Or, if the value of a cell is 13.362145, but it's showing 13.36, I want to
make the value of that cell 13.36.

Only, I don't want to do this for the entire sheet, just the selected range.
I'm thinking that if I create a custom function that says

For Each objC In Application.Selection.Cells

objC.Value = objC.DisplayedValue

Next

Only, I can't seem to find what that "displayed value" property is.

Any help would be great. Thanks.

--
Hmm...they have the Internet on COMPUTERS now!

Trevor Shuttleworth

Get Displayed Value Of a Cell
 
Msgbox Range("A1").Text

or, in your example:

For Each objC In Selection
objC.Value = objC.Text
Next


Regards

Trevor


"MDW" wrote in message
...
I'm trying to write a function that does the same thing as the "precision
as
displayed" setting, but only for a certain range (the selected cells). Is
there any way to get at the displayed value of a cell? I think that will
help
me accomplish what I want.

For instance, if the ACTUAL value of a cell is 76.5, but it's showing 77
on
the worksheet, I want to make the value of that cell 77.

Or, if the value of a cell is 13.362145, but it's showing 13.36, I want to
make the value of that cell 13.36.

Only, I don't want to do this for the entire sheet, just the selected
range.
I'm thinking that if I create a custom function that says

For Each objC In Application.Selection.Cells

objC.Value = objC.DisplayedValue

Next

Only, I can't seem to find what that "displayed value" property is.

Any help would be great. Thanks.

--
Hmm...they have the Internet on COMPUTERS now!




Bob Phillips[_6_]

Get Displayed Value Of a Cell
 
Range("A1").Text

is what you want as against .Value.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"MDW" wrote in message
...
I'm trying to write a function that does the same thing as the "precision

as
displayed" setting, but only for a certain range (the selected cells). Is
there any way to get at the displayed value of a cell? I think that will

help
me accomplish what I want.

For instance, if the ACTUAL value of a cell is 76.5, but it's showing 77

on
the worksheet, I want to make the value of that cell 77.

Or, if the value of a cell is 13.362145, but it's showing 13.36, I want to
make the value of that cell 13.36.

Only, I don't want to do this for the entire sheet, just the selected

range.
I'm thinking that if I create a custom function that says

For Each objC In Application.Selection.Cells

objC.Value = objC.DisplayedValue

Next

Only, I can't seem to find what that "displayed value" property is.

Any help would be great. Thanks.

--
Hmm...they have the Internet on COMPUTERS now!




MDW

Get Displayed Value Of a Cell
 
Wow, I can't believe that one went over my head. I almost feel silly.

Thanks guys - works like a charm!

"Bob Phillips" wrote:

Range("A1").Text

is what you want as against .Value.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"MDW" wrote in message
...
I'm trying to write a function that does the same thing as the "precision

as
displayed" setting, but only for a certain range (the selected cells). Is
there any way to get at the displayed value of a cell? I think that will

help
me accomplish what I want.

For instance, if the ACTUAL value of a cell is 76.5, but it's showing 77

on
the worksheet, I want to make the value of that cell 77.

Or, if the value of a cell is 13.362145, but it's showing 13.36, I want to
make the value of that cell 13.36.

Only, I don't want to do this for the entire sheet, just the selected

range.
I'm thinking that if I create a custom function that says

For Each objC In Application.Selection.Cells

objC.Value = objC.DisplayedValue

Next

Only, I can't seem to find what that "displayed value" property is.

Any help would be great. Thanks.

--
Hmm...they have the Internet on COMPUTERS now!





Trevor Shuttleworth

Get Displayed Value Of a Cell
 
You're welcome. Thanks for the feedback.


"MDW" wrote in message
...
Wow, I can't believe that one went over my head. I almost feel silly.

Thanks guys - works like a charm!

"Bob Phillips" wrote:

Range("A1").Text

is what you want as against .Value.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"MDW" wrote in message
...
I'm trying to write a function that does the same thing as the
"precision

as
displayed" setting, but only for a certain range (the selected cells).
Is
there any way to get at the displayed value of a cell? I think that
will

help
me accomplish what I want.

For instance, if the ACTUAL value of a cell is 76.5, but it's showing
77

on
the worksheet, I want to make the value of that cell 77.

Or, if the value of a cell is 13.362145, but it's showing 13.36, I want
to
make the value of that cell 13.36.

Only, I don't want to do this for the entire sheet, just the selected

range.
I'm thinking that if I create a custom function that says

For Each objC In Application.Selection.Cells

objC.Value = objC.DisplayedValue

Next

Only, I can't seem to find what that "displayed value" property is.

Any help would be great. Thanks.

--
Hmm...they have the Internet on COMPUTERS now!








All times are GMT +1. The time now is 01:00 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com