update a textbox user form when user form is open

Lauren279

Board Regular
Joined
Aug 19, 2014
Messages
91
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!
 

Some videos you may like

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.

AlphaFrog

MrExcel MVP
Joined
Sep 2, 2009
Messages
16,276
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
91
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:
 

Watch MrExcel Video

Forum statistics

Threads
1,108,954
Messages
5,525,880
Members
409,669
Latest member
JDCupps

This Week's Hot Topics

Top