PDA

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



Rlb53
08-24-2011, 01:58 PM
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.


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

Thank you for your assistance.

Bob Phillips
08-24-2011, 02:15 PM
Private Sub TextBox1_Change()
With Range("M200_Inv_Balance")
UserForm13.TextBox1.Text = .Cells(.Rows.Count, 1).Value
End With

Rlb53
08-24-2011, 02:21 PM
Thank You XLD... however.. TextBox1 is still coming up empty.

Bob Phillips
08-24-2011, 04:30 PM
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



Private Sub UserForm_Activate()
With Range("M200_Inv_Balance")
UserForm13.TextBox1.Text = .Cells(.Rows.Count, 1).Value
End With
End Sub

Rlb53
08-24-2011, 04:34 PM
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.