Text vs Value

NorthbyNorthwest

Board Regular
Joined
Oct 27, 2013
Messages
154
Office Version
  1. 365
Hi, everyone. I created a workbook that mostly transfers information from a data entry form to rows in a worksheet. The workbook also performs a two or three vlookups. I referenced cell ranges with “.value.” Is this OK? I noticed that the “.value” does not capitalizes to “.Value.” But when I use “.text” it capitalizes to “.Text.” Does this mean I should be using “.text.” I ask because the workbook seems to perform OK with “.value.” I would like to understand what is correct. I never noticed this earlier coding. Wondering if I’m overthinking.
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
If it's working OK, you might be overthinking it....but if you post the code someone will have a look to see if there any issues
 
Upvote 0
Range.Text is a read-only property. It cannot be used to change the value of a cell. It returns what you see in the cell whereas for non-formulaic cells, .Value returns what you see in the formula bar and can be used to change the value in a cell. For example, if you enter 10000 in a cell and format it as currency with two decimal places, when you look at the cell it shows $10,000.00 (the .Text property), while the formula bar shows 10000 (the .Value property). For VLookups I would use .Value.

EDIT: Actually for the example I used (currency) I would choose the Value2 property.
 
Last edited:
Upvote 0
Solution
If it's working OK, you might be overthinking it....but if you post the code someone will have a look to see if there any issues
Thanks for responding so quickly. I think I just needed reassurance. Sometimes a little thing can rattle me.
 
Upvote 0
Range.Text is a read-only property. It cannot be used to change the value of a cell. It returns what you see in the cell whereas for non-formulaic cells, .Value returns what you see in the formula bar and can be used to change the value in a cell. For example, if you enter 10000 in a cell and format it as currency with two decimal places, when you look at the cell it shows $10,000.00 (the .Text property), while the formula bar shows 10000 (the .Value property). For VLookups I would use .Value.

EDIT: Actually for the example I used (currency) I would choose the Value2 property.
Thanks JoeMo for explaining the difference between the properties. In reviewing my code I found two textboxes in which I was in some instances referencing them as .text and other instances .value. Your explanation helped know which to use. My thanks again to both you and Michael.
 
Upvote 0
Glad we could help.
I think @JoeMo provided sufficient insight into your issue..:cool:(y)
 
Upvote 0
I noticed that the “.value” does not capitalizes to “.Value.” But when I use “.text” it capitalizes to “.Text.”
That is probably because you have (at some point) created a variable or procedure called value, which will affect the capitalisation.
 
Upvote 0

Forum statistics

Threads
1,215,507
Messages
6,125,201
Members
449,214
Latest member
mr_ordinaryboy

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