ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RefEdit ActiveX control (https://www.excelbanter.com/excel-programming/323158-refedit-activex-control.html)

Simon Shaw[_5_]

RefEdit ActiveX control
 
Hi,

I have a RefEdit control in my form, but I would like to force it to require
the selection of columns similar to using Page Setup where you select the
Columns to repeat on the left. Where the mouse cursor appears as a down
arrow, and no matter what you click, you select an entire column(s).

Is there a property of the RefEdit that I can change to force this? I
looked, but don't see anything obvious.

Thanks

Simon

Jim Cone

RefEdit ActiveX control
 
Simon,

RefEdit Controls are difficult to live and work with.
Give the following a try (note the RefEdit has been renamed).
'----------------------------------------------------------
Private Sub RefEditTest_Change()
On Error Resume Next
Dim objRng As Excel.Range
Set objRng = Range(RefEditTest.Text).EntireColumn
If Err.Number < 0 Then Set objRng = Selection.EntireColumn
On Error GoTo NoRange
objRng.Select
Me.RefEditTest.Text = objRng.Address
Set objRng = Nothing
Exit Sub
NoRange:
Beep
Resume Next
End Sub

Private Sub UserForm_Initialize()
' Do not set the focus to the RefEdit control.
Me.RefEditTest.Text = Selection.Columns.Address
End Sub
'------------------------------------------------------

Regards,
Jim Cone
San Francisco, USA



"Simon Shaw" wrote in message
...
Hi,

I have a RefEdit control in my form, but I would like to force it to require
the selection of columns similar to using Page Setup where you select the
Columns to repeat on the left. Where the mouse cursor appears as a down
arrow, and no matter what you click, you select an entire column(s).
Is there a property of the RefEdit that I can change to force this? I
looked, but don't see anything obvious.
Thanks
Simon



All times are GMT +1. The time now is 03:34 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com