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

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
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
It does work

Both

But the issue is it showing only the last entry, not my previous entered customer names
 
Upvote 0
You said that the previous enteries are stored in the Excel sheet in column h. Thats why we are returning the latest value if column H.
 
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,214,615
Messages
6,120,538
Members
448,970
Latest member
kennimack

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