How do I get data from a cell into a userform and update it as I go?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,210
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,
Its been a while since i've needed to use a userform but could do with some help remembering how to do something that sounds simple.
I have a vba macro that when run perferms a number of comands in a loop (See vba below)
I call Userform2, when it starts.
I want to put a "textbox"? (or whatever you suggest) into Userform" and show the value thats in cell G3
This value changes everytime the loop happens so id like to update the userform?

hope that made sense?
any help would be great

VBA Code:
Sub Open_n_Close_Dashboards1()

UserForm2.Show (vbModeless)
Just here I want to load a value into user form from G3

For Each Cl In Projects.Range("A1", Projects.Range("A" & Rows.Count).End(xlUp))
User.Range("G3").Value = Projects.Range("A" & Cl.Row).Value

Just here, I want to UPdate the Userform!!!!!

ProjectName = User.Range("G3").Value & "/"

FolderName = "https://camhcr.sharepoint.com/sites/Finance-Finance-Confidential/Shared%20Documents/Finance%20-%20Confidential/Accounts/Mgmt%20Accounts/Project%20Reports/2022_Projects/"
Filename = User.[G3].Value & "_Dashboard" & ".xlsm"
If Filename = "" Then Exit Sub

Fname = FolderName & ProjectName & Filename

AAA_events_off
Application.ScreenUpdating = False

With Workbooks.Open(Fname, UpdateLinks:=0)

Call SalesUpdate_TW

.Close True
End With

Next Cl

AAA_events_on
Application.ScreenUpdating = True
Application.CutCopyMode = False

Unload UserForm2
MsgBox "Update Done!", , ""

End Sub
 

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 this:
VBA Code:
Userform2.<textboxname>= User.Range("G3").Value
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,771
Members
452,353
Latest member
strainu

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