Thread: RefEdit
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Jim Rech Jim Rech is offline
external usenet poster
 
Posts: 2,718
Default RefEdit

I just slapped a refedit and a command button on a userform. I attached
this code to the button:

Private Sub CommandButton1_Click()
Dim Rg As Range
Set Rg = Range(RefEdit1.Text)
MsgBox Rg.Address
End Sub

I run the userform and click on the refedit. Then I select a range in the
current sheet and click the command button. The message box shows me the
range I selected. You must be skipping some step. Maybe the selecting in
the sheet?

--
Jim
"SteveDB1" wrote in message
...
| hi all.
| I posted in another post yesterday regarding my first user form.
| The one response I received in return said that in order to allow the user
| to select a range, I needed to use the RefEdit control.
| We recently purchased John Walkenbach's Power Programming book for Excel
| 2007, and in reading the discussion on refedit, I'm unclear on the syntax
I
| need to use to make my textboxes work.
|
| On pages 452/453 of his book is the discussion for RefEdit.
| I get a type mismatch error when I use Set, and no error when I use Let.
But
| it doesn't allow me to select a range, either way.
|
|
| Either way it still does not allow me to select a range.
| I then did some searching on the MS KB, and found an old discussion on
this
| topic-- from 2000, 2002. http://support.microsoft.com/kb/213776
| It has the code for a command_Click button-
| Dim SelRange as Range
| Dim Addr as String
|
| 'Get the address, or reference, from the RefEdit control.
| Addr = RefEdit1.Value
|
| 'Set the SelRange Range object to the range specified in the
| 'RefEdit control.
| Set SelRange = Range(Addr)
|
| This too does not allow for a range selection.
|
| At this point, I'm just frustrated.
| If I require a RefEdit to select a range, how am I suppose to state it?
|
|
| Thank you.
| SteveB.
|