Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 69
Default Displaying cell contents

I wonder if it's possible when adding data to cells using VBA, to have one actual value (as seen in the Formula Bar) and another value that is displayed in the cell? I tried the Range.Value and Range.Text properties, but Range.Text won't work.

Range("D2").Value = "value"
Range("D2").Text = "text"

Row 2 gives error 424, object required. What kind of object does Text want?

Gustaf
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 533
Default Displaying cell contents

I think it wants the kind of object that can have its Text property changed.
For a range the Text property is read only.

You cannot have a different value in the cell than appears in the formula
bar, other than for number formatting. For example you could enter 1.234 in
a cell and number format it to show only 2 decimal places - 1.23.

Taken to an extreme you could give the cell a custom number format like
"2222" which is what would always appear in the cell if any number is
entered.

You could also cover the cell with a text box and enter a different number
in it.

--
Jim
"Gustaf" wrote in message
...
|I wonder if it's possible when adding data to cells using VBA, to have one
actual value (as seen in the Formula Bar) and another value that is
displayed in the cell? I tried the Range.Value and Range.Text properties,
but Range.Text won't work.
|
| Range("D2").Value = "value"
| Range("D2").Text = "text"
|
| Row 2 gives error 424, object required. What kind of object does Text
want?
|
| Gustaf


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Displaying cell contents BlueAngel Excel Discussion (Misc queries) 3 March 6th 10 01:12 AM
Displaying contents of Active Cell Rope Excel Discussion (Misc queries) 4 June 30th 09 10:03 AM
Displaying Cell Contents ajones1978 Excel Discussion (Misc queries) 3 September 10th 08 10:35 PM
Help with displaying the contents of the last populate cell. Pank New Users to Excel 9 April 4th 07 06:25 PM
Displaying contents of cell on different spreadsheet telewats Excel Discussion (Misc queries) 1 January 26th 06 04:58 PM


All times are GMT +1. The time now is 02:22 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"