Range().Text line in vba generates a 424 error

bearcub

Well-known Member
Joined
May 18, 2005
Messages
731
Office Version
  1. 365
  2. 2013
  3. 2010
  4. 2007
Platform
  1. Windows
I understand that the text property for the Range object is a read only property. Does this mean that I can use this to paste a value in a cell though I can read a cell as text?

Are there any good articles that explain what a read only property does in VBA as opposed to a read/write property.

In other words, I can have

Range().value (value property is read/write?) = Range().text but I get a 424 error when I run this:

Range().text = Range().text

Does the text property someone change the Range object to a non-object?

Why does the 424 error not occur in the first statement ( a value to a text cell) but is pops up if I assign the text property to a text property (read only)

Thank you for your help,

Michael
 

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
Range("A1").value is a both a read and a write property

That means you can use VBA code to read the value stored in Range("A1"), e.g.
Code:
Dim X as variant

X = Range("A1").Value
Or you can store (write) a new value to Range("A1"), e.g.
Code:
Dim X as variant

X = "Cat"
Range("A1").Value = X
Range("A1").text is a read (read-only) property, so this is legal
Code:
X = Range("A1").text
but this is not
Code:
X = "Cat"
Range("A1").Text = X
 
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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