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

bearcub

Well-known Member
Joined
May 18, 2005
Messages
701
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

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
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,214,641
Messages
6,120,692
Members
448,979
Latest member
DET4492

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