Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

https://stackoverflow.com/a/65819360/5079799

Option Explicit

Public rng As Range

Public Sub UserForm_Initialize()
  Me.TextBox1.DropButtonStyle = fmDropButtonStyleReduce
  Me.TextBox1.ShowDropButtonWhen = fmShowDropButtonWhenAlways
  Set rng = Range("A1:B4")
  TextBox1.Value = rng.Address(False, False)
End Sub

Public Sub CommandButton1_Click()
 rng.Select
 Unload Me
End Sub

Public Sub TextBox1_DropButtonClick()
    Me.Hide
    Set rng = Application.InputBox("Select the range", "Range Picker", TextBox1.Text, Type:=8)
    TextBox1.Value = rng.Address(False, False)
    Me.Show
End Sub
  • No labels