VBA Code to Auto Fill Text Box

singupalli

New Member
Joined
Apr 19, 2011
Messages
34
Hi

I have a text box in the user form to fill Customers name,

The the previous enteries are stored in the Excel sheet. in column h

when i make a new entry Via the user form, i want the text box Customer name to show the previous entry if already entered/Exists, if not the new name will be typed

Please anyone
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Hi Singupalli,


Use below code in UserForm_Click() or UserForm_Initialize()
TextBox1.Text = Range("H65536").End(xlUp).Value

Regards,
Kunal
 
Upvote 0
Not sure if this is what you are looking for but if you are populating column H with customers names in order (ie the last entered customer is in the last row) then you should be able to set up a text box to display the last row's value upon initialization of the userform.

Example:
Code:
Private Sub TextBox1_Enter()
TextBox1.Value = Range("H" & Rows.Count).End(xlUp).Value
End Sub
 
Upvote 0
The way i put it was wrong.


I want the Text Box of Customers to show me the list of Customers in ColumnH, But if None then i enter the new customers name, this new name.

sorry
 
Upvote 0
Do you mean this way:
Suppose we have below names in Column H

John
Ran
Michell
Ramaon
Shane

Then the text box to display all the above names as below:
John Ran Michell Ramaon Shane
??
 
Upvote 0
Use a combobox to display the list of customers.

You can then use that to get the data for the chosen customer from the worksheet.
 
Upvote 0
yes Kunal

Thats almost what i want,

But for example i already Have John and Joseph

then
When i type "Jo" al names with :Jo pop up
Joh - then i get John
Jos - then i get Joseph
 
Upvote 0

Forum statistics

Threads
1,224,586
Messages
6,179,723
Members
452,939
Latest member
WCrawford

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