Userform textbox to display realtime a worksheet cell's dynamic value

KarlRadaza

New Member
Joined
Nov 27, 2018
Messages
14
Problem seems so simple yet almost impossible for me to solve, hope you guys can help me.


I basically just need a textbox on a userform to reflect the value calculated on a worksheet cell. I have tried sourcing the cell where i learned that deletes the formula in the cell, evenso those formulas like:


UserForm1.TextBox1.Text = CStr(Range("c5").Value)
UserForm1.Show


and


Private Sub UserForm_Initialize()
Me.TextBox1.Text = CStr(ThisWorkbook.Sheets("Sheet1").Range("C5").Value)
End Sub


They would only show the recent value in the worksheet when the userform runs but does not change accordingly with the cell's updated value.
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
You need code in the worksheet module for Sheet1 to do this; it cannot be done within the UserForm module.

It's not necessary to do a string conversion.

Rich (BB code):
Private Sub Worksheet_Change(ByVal Target As Range)

   If Not Intersect(Target, Range("C5")) Is Nothing Then
      UserForm1.TextBox1.Text = Range("C5").Text
   End If
   
End Sub
 
Last edited by a moderator:
Upvote 0
Thanks for the reply 6StringJazzer, but unfortunately it still only shows the latest value upon running the userform but not changing as the cell value does. :(
 
Upvote 0
What is causing the cell value to change? Is there a formula in the cell, or a value?

If it's a formula, my method will not work and you would need

Code:
Private Sub Worksheet_Calculate()

   UserForm1.TextBox1.Text = Range("C5").Text

End Sub
 
Upvote 0
Yep, the worksheet cell does have a formula, and the latest formula you suggested did the trick! Awesome! Thanks a lot 6stringjazzer! \m/
 
Upvote 0
Glad to help! That's a tough one without being able to see your file.
 
Upvote 0

Forum statistics

Threads
1,215,514
Messages
6,125,263
Members
449,219
Latest member
daynle

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top