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

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
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]
 
Upvote 0
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:
 
Upvote 0

Forum statistics

Threads
1,213,549
Messages
6,114,264
Members
448,558
Latest member
aivin

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