RefEdit (ref)

alt textRef Edit - This control allows the user to select a range of cells in Excel.

alt text

Additional Reference

References - RefEdit.Ctrl


alt text

There are a few things to keep in mind when you are using this control


The RefEdit control returns a text string that represents a range address
You can convert this string to a range object using the following statement:

Set objRange = Range(RefEdit.Text) 

It is a good idea to initialise this control to display the current selection

RefEdit.Text = ActiveWindow.RangeSelection.Address 

Do not always assume that it will always return a valid range address.
The user can also type directly into this control so you need to make sure the value entered is valid.
You cannot assume the selection made is on the same worksheet as the user may select worksheet tabs.
If a different sheet is selected the range is preceded by the name of the sheet


If you only need a single cell you can obtain the top left cell from the range

objCell = Range(RefEdit.Text).Range("A1") 

You should always put this control directly onto a userform, do not place it inside any other controls (for example frames)
Never make a userform modeless if it contains a RefEdit control.


Properties

AutoSize 
AutoTab 
AutoWordSelect 
BackColor 
BackStyle 
BorderColor 
BorderStyle 
ControlTipText 
DragBehavior 
Enabled 
EnterFieldBehavior 
EnterKeyBehavior 
Font 
ForeColor 
Height 
HelpContextID 
HideSelection 
IMEMode 
IntegralHeight 
Left 
Locked 
MaxLength 
MouseIcon 
MousePointer 
MultiLine 
PasswordChar 
ScrollBars 
SelectionMargin 
SelLength 
SelStart 
SelText 
SpecialEffect 
TabIndex 
TabKeyBehavior 
TabStop 
Tag 
Text 
TextAlign 
Top 
Value 
Visible 
Width 
WordWrap 

Events

AfterUpdate 
BeforeDragOver 
BeforeDragOrPaste 
BeforeUpdate 
Change 
DblClick 
DropButtonClick 
Enter 
Error 
Exit 
KeyDown 
KeyPress 
KeyUp 
MouseDown 
MouseMove 
MouseUp 

RefEdit - http://blogs.msdn.com/gabhan_berry/archive/2008/06/12/net-refedit-control.aspx
RefEdit - http://www.codeproject.com/KB/selection/RefEditControl.aspx


© 2022 Better Solutions Limited. All Rights Reserved. © 2022 Better Solutions Limited TopPrevNext