How can I get a textbox (or lable ) on a user form to update each time a macro loops

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,194
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,

so i have this code

VBA Code:
Sub Send_Everyone()
    Dim myRange As Range
    Dim cell As Range

UserForm2.Show (vbModeless)
UserForm2.Repaint
Application.EnableEvents = False
Application.ScreenUpdating = False

Set myRange = EmailA.Range("F8:F" & Lr)

    For Each cell In myRange
    
If cell.Offset(0, -1).Value = "" Then
Raw.[Q1].Value = cell.Value
Raw.[Q2].Value = cell.Offset(0, 1).Value
End If
    Next cell

Application.EnableEvents = True
Application.ScreenUpdating = True
Unload UserForm2

End Sub

all works fine but id like to display the data in cell Q3 in Textbox1

currently this hapens at the start using code
VBA Code:
Private Sub UserForm_Initialize()
TextBox1.Value = EmailA.Range("Q3").Value
End Sub
but the figues in Q3 increase each time the macro loops but the text box does not update,
any ideas how i can get it to update each time the macro loops?

thanks

Tony
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Try using DoEvents:
VBA Code:
UserFormX.TextBox1.Value = EmailA.Range("Q3").Value
DoEvents
 
Upvote 0
Solution

Forum statistics

Threads
1,214,920
Messages
6,122,267
Members
449,075
Latest member
staticfluids

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