none
How to display in textbox the range in input box RRS feed

  • Question

  • Hi,

    I have userform with inputbox & and textbox. by pressing a command button I want to display in the text box the selected range in input box for example $A$2:$B$11.

    My code is:

    Private Sub SelectRange_Click()

    Dim Test As Range

    On Error Resume Next
    Set Test = Application.InputBox(Prompt:="Select customers range", Title:="bla bla", Type:=8)

     

    If Err.Number = 0 Then
        Test.Select
        CustomerRange.Text = "I want to display the range"
    End If

    Err.Clear
    On Error GoTo 0

     

     

    End Sub


    Guy Zommer

    Wednesday, January 8, 2014 8:50 AM

Answers

  • OK,

    I solved this:

    Private Sub SelectRange_Click()

    Dim Test As Range

    On Error Resume Next
    Set Test = Application.InputBox(Prompt:="Select customers range", Title:="bla bla", Type:=8)

    If Err.Number = 0 Then
        Test.Select
        CustomerRange.Text = test.address
    End If

    Err.Clear
    On Error GoTo 0

    End Sub


    Guy Zommer

    • Marked as answer by Guy Zommer Wednesday, January 8, 2014 9:05 AM
    Wednesday, January 8, 2014 9:05 AM