Cell value in a userform

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.

Diablo II

Well-known Member
Joined
Sep 28, 2008
Messages
538
ok lets say you have a textbox and lets call it textbox1 then you would type in the

Code:
Private Sub UserForm_Initialize()
textbox1 = Range("A1").Value
end sub
 

mtheriault2000

Well-known Member
Joined
Oct 23, 2008
Messages
826
Hello again Diablo II

Code:
Private Sub UserForm_Initialize()
UserForm1.Show
Sheets("Sat_Sheet").Select
TextBox1 = RANGE("M1_H1").Value
End Sub

When run, the userform is displayed, but TextBox1 is not modified.

Quest continues

Martin
 
Last edited by a moderator:

Colin Legg

MrExcel MVP
Joined
Feb 28, 2008
Messages
3,497
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi,

Remove the UserForm1.Show line from the userform's initialize event handler.


and then change this:
Code:
Sheets("Sat_Sheet").Select
TextBox1 = RANGE("M1_H1").Value

to this:
Code:
TextBox1.Value = Sheets("Sat_Sheet").Range("M1_H1").Value
 

mtheriault2000

Well-known Member
Joined
Oct 23, 2008
Messages
826

ADVERTISEMENT

OK, it work, I place the userform.show after the Textbox assignation value

Many thanks

I progress,,,, slowly,,,, but progress

Martin
 
Last edited:

Diablo II

Well-known Member
Joined
Sep 28, 2008
Messages
538
put your userform1.show in a button by its self, the Private Sub UserForm_Initialize just tells the form what to do when it starts. i use it so that way when the form started it will fill the textbox with a value form a sheets cell. hhmm i have not seen the use of _ in a range i can not get the _ to work . will you wont from range M1 to H1 to show ? if so you may need a listbox , or set the textbox like this and if you wont the ranges after H1 like I1 J1 and so on you will need to add & then the next range to put space do & " " &
TextBox1.Value = Sheets("Sheet1").Range("M1 ").Value & " " & Range(" H1").Value
 

mtheriault2000

Well-known Member
Joined
Oct 23, 2008
Messages
826
Hello Diablo

Just to clarifie

Range("Hi_M1") = High (value) in Market 1
Range("Lo_M4") = Low in Market 4


My range definition is ok

Have a great day :biggrin:

Martin

Martin
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,669
Messages
5,838,682
Members
430,563
Latest member
Raeyven

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
Top