Consulting

Results 1 to 5 of 5

Thread: Solved: Retrieve a value from the last cell and post it in a textbox

  1. #1
    VBAX Contributor
    Joined
    Aug 2011
    Posts
    126
    Location

    Solved: Retrieve a value from the last cell and post it in a textbox

    I'd like to retrieve a value from the last cell within a named range (which is a column) of a named worksheet and post the value within a textbox of a userform.

    I'd like for the information to be retrieved without changing the viewed screen. Hence creation of the userform.

    This certainly does not work.

    [vba]
    Private Sub TextBox1_Change()
    UserForm13.TextBox1.Text = Range("M200_Inv_Balance", Cells(Rows.Count, 0).End(xlUp)).Value
    [/vba]End Sub

    Thank you for your assistance.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Private Sub TextBox1_Change()
    With Range("M200_Inv_Balance")
    UserForm13.TextBox1.Text = .Cells(.Rows.Count, 1).Value
    End With [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Contributor
    Joined
    Aug 2011
    Posts
    126
    Location
    Thank You XLD... however.. TextBox1 is still coming up empty.

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Maybe it is because you are trying to load it in that textbox's change event. Try loading it elsewhere, such as activating the form

    [vba]

    Private Sub UserForm_Activate()
    With Range("M200_Inv_Balance")
    UserForm13.TextBox1.Text = .Cells(.Rows.Count, 1).Value
    End With
    End Sub[/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  5. #5
    VBAX Contributor
    Joined
    Aug 2011
    Posts
    126
    Location
    Thank you Again !

    Just at the moment I recieved your response, I solved the issue by creating a specified cell on the associated worksheet that would acquire the value of the "Last Cell" within the designated column. I then referenced the cell with results to the Textbox.

    Thank you immensely for your assistance.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •