Cell value in a userform

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
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
 
Upvote 0
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:
Upvote 0
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
 
Upvote 0
OK, it work, I place the userform.show after the Textbox assignation value

Many thanks

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

Martin
 
Last edited:
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,824
Messages
6,121,783
Members
449,049
Latest member
greyangel23

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