How to auto update Userform.textbox value on each pass thru

Spock's Brain

New Member
Joined
Mar 19, 2002
Messages
18
I must be missing the blindingly obvious.
In Lotus I could automatically update the display in a msgbox with each pass thru a loop.
How can I do this with a userform in Excel so that the value in a textbox automatically changes with each loop?
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
It might be that I am missing the point of your post but to set the value of a textbox in a userform all you need to write is something like:

UserForm1.yourTextBox.Value = yourVariableHere

before you display the userform (Userform1.Show)

Surely each time you pass through the loop you can reset yourVariableHere to whatever value you want?

If I'm on the wrong track, give us all a bit more information and see what other ideas are thrown up!

Rgds
AJ
 
Upvote 0
CommandButton1 is on Userform1. Textbox1 does not increment on each loop. I only get the end value (1000) on the last loop, ;o(

Private Sub CommandButton1_Click()
For x = 1 To 1000
UserForm1.TextBox1.Value = x
Next
End Sub
 
Upvote 0
REPAINT seems to be the answer. It updates the textbox on each loop but does cause some userform 'flutter'.

Private Sub CommandButton1_Click()
For x = 1 To 1000
USERFORM.REPAINT
UserForm1.TextBox1.Value = x
Next
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,551
Messages
6,114,268
Members
448,558
Latest member
aivin

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