Excel VBA RefEdit Control - Excel Range GUI Control

September 2016


This Control will give the user to manually select an excel range and use it properties to control selected range.
in this example we'll embed the RefEdit Control and use it to manipulate the selected range.
For more information about how to create a GUI please visit:
Excel VBA UserForm

the main UI should look like this:


to add the RefEdit control right click on the ToolBox window and follow these steps


Coding

Set Fill Color Button:
Private Sub Button1_Click()
On Error GoTo errorHandler
    Range(RefEdit1.Value).Activate
    Application.Dialogs(xlDialogPatterns).Show
    Range("a1").Activate
    RefEdit1.Value = ""
errorHandler:
    Exit Sub
End Sub

Set Text
Private Sub Button2_Click()
On Error GoTo errorHandler
    Range(RefEdit1.Value).Activate
    Application.Dialogs(xlDialogFontProperties).Show
    Range("A1").Activate
    RefEdit1.Value = ""
errorHandler:
    Exit Sub
End Sub


Related :

This document entitled « Excel VBA RefEdit Control - Excel Range GUI Control » from CCM (ccm.net) is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.