Pulling Data from a sheet into a userform

tonywatsonhelp

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

I have a userform called Userform1
and i want to pull data into it from
Sheets("Form Info").Range("A1")

I tried this but it didn't work any ideas how i do this and what i did wrong?

Thanks

Tony

Code:
[FONT=Calibri][SIZE=3][COLOR=#000000]Sub AAA_Calender1_tests()[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]      UserForm1.Show[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]     UserForm1.TextBox1.Value = Sheets("Form Info").Range("A1").Value[/COLOR][/SIZE][/FONT]
[FONT=Calibri][SIZE=3][COLOR=#000000]End Sub[/COLOR][/SIZE][/FONT]
 

Excel Facts

Formula for Yesterday
Name Manager, New Name. Yesterday =TODAY()-1. OK. Then, use =YESTERDAY in any cell. Tomorrow could be =TODAY()+1.
Tony,

Please try:

Code:
[COLOR=#000000][FONT=Calibri]UserForm1.TextBox1.Value = [/FONT][/COLOR]ThisWorkbook.Worksheets("[COLOR=#000000][FONT=Calibri]Form Info[/FONT][/COLOR]")[COLOR=#000000][FONT=Calibri].Range("A1").Value[/FONT][/COLOR]
 
Upvote 0
Thank you Kev,
Turns out I just had the order the wrong way Should do Show after but thanks for your help
Tony
 
Upvote 0
Tony,

I like to set my values in the initialize event of the user form. Just another option...

Code:
Sub AAA_Calender1_tests()
      UserForm1.Show
End Sub

Code:
Private Sub UserForm_initialize()
     Me.TextBox1.Value = ThisWorkbook.Worksheets("Form Info").Range("A1").Value
End sub
 
Upvote 0

Forum statistics

Threads
1,214,592
Messages
6,120,433
Members
448,961
Latest member
nzskater

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