refedit to select single cell not range

Steve Manning

New Member
Joined
Sep 10, 2002
Messages
3
Hello is there a way to have refedit select the contents of only a single cell? I have a macro that seems to crash because I'm trying to enter (refedit.text) into a single cell. I think it is crashing because the refedit returns a range.
Thanks for any ideas.
Steve
 

Excel Facts

What is =ROMAN(40) in Excel?
The Roman numeral for 40 is XL. Bill "MrExcel" Jelen's 40th book was called MrExcel XL.
Hi Steve,

The problem is not that refedit returns a Range. Even a single cell IS a Range object, albeit a special case. The .Text (and .Value) properties of the Refedit control are not cells or Range objects, they are simply text strings identifying the address of the range. If you want the Range object corresponding to the address string returned by the Refedit object you must use the Range property. For example:

Range(RefEdit1.Text).Value= "Hi there"

puts the string "Hi there" into the cell or cells defined by RefEdit1. If you use the RefEdit to select multiple cells and want the string to be put only in the first cell of the range you can do this:

Range(RefEdit1.Text).Cells(1).Value = "Hi there"

I hope this helps.
 
Upvote 0

Forum statistics

Threads
1,218,920
Messages
6,145,216
Members
450,602
Latest member
AceSpace

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