update a textbox user form when user form is open

Lauren279

Board Regular
Joined
Aug 19, 2014
Messages
95
hi

i would like a textbox userform (called Ref) to update with a number with in a spreadsheet

the number is in column A and it needs to show in the textbox if in column B is blank

i have tired using

Private Sub Ref_Enter()
Ref.Text = Range("b" & Rows.Count).End(xlUp).Offset(0, -1).Value
End Sub

but nothing happens

Please Help!
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,449
The description is thin on detail.

Based on the thread Title, if you want to populate the textbox when the userform initializes...

Code:
[color=darkblue]Private[/color] [color=darkblue]Sub[/color] [COLOR=#ff0000]UserForm_Initialize()[/COLOR]
    Ref.Text = Range("b" & Rows.Count).End(xlUp).Offset(0, -1).Value
End [color=darkblue]Sub[/color]
 

Lauren279

Board Regular
Joined
Aug 19, 2014
Messages
95
thank you, i also had it has not the userform code

sorry the description was thin, i couldn't figure out how to describe the problem, but it is all fixed now and working (it was the initialize part i was missing)

thanks heaps
<o:p></o:p>
:):LOL:
 
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,163,486
Messages
5,831,970
Members
430,099
Latest member
rdhoy

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