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,210
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

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Try using DoEvents:
VBA Code:
UserFormX.TextBox1.Value = EmailA.Range("Q3").Value
DoEvents
 
Upvote 0
Solution

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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