Userform textboxs autofill

Kingchaos64

New Member
Joined
Jan 15, 2021
Messages
46
Office Version
  1. 365
Platform
  1. Windows
I have a UserForm2 with 3 textbox columns.
'Claim Check, City, Employee Int'.
Is there a way to make the City and Employee textboxes auto populate with the City and Employee that was entered right above it?
Claim Check textbox (Name) starts at c1 the one below it is c2 and so on. City textbox is s1 the one below it is s2 and so on and Employee is e1 and below is e2.

I attached a photo of an example of what I would like to see when I enter the first set of data.

Just trying to make this a faster data entry. Claim checks will always change but city and Employee will only change a bit.
 

Attachments

  • 20210206_182150.jpg
    20210206_182150.jpg
    132 KB · Views: 41
I'm glad it works.:)
But there's something else you might need.
When you add data to the listbox, is it possible that you've added wrong data so you need to delete or modify it before you send it to the sheet?
If yes then we need another code to deal with that.
Oh i didn't know you couldn't delete once it's inside the listbox. Good looking out. Yes I think having some type of edit or delete button would be needed just in case
 
Upvote 0

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Oh i didn't know you couldn't delete once it's inside the listbox. Good looking out. Yes I think having some type of edit or delete button would be needed just in case
Would it be hard to make it to where you click on the line you want to delete in the listbox and then press the button to delete?
 
Upvote 0
Delete by double-clicking an item in the listbox:
Add this code:
VBA Code:
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
If MsgBox("Do you want to delete this record?", vbOKCancel) = vbCancel Then Exit Sub
ListBox1.RemoveItem ListBox1.ListIndex
End Sub
 
Upvote 0
Delete by double-clicking an item in the listbox:
Add this code:
VBA Code:
Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
If MsgBox("Do you want to delete this record?", vbOKCancel) = vbCancel Then Exit Sub
ListBox1.RemoveItem ListBox1.ListIndex
End Sub
Works like a charm. Big thanks to you and Zot
 
Upvote 0
You're welcome, glad to help & thanks for the feedback. :)
 
Upvote 0
You can just count how my column from E to NZ and then divide by 3. Since Claim, City and Emp in group of three, the answer would be the count.... right?

Something like Range("E5", "NZ5").Count/3. YOu should get round number
Hey Zot how would I get this code to work.. and go into the C Column when a new row is added?
This is literally the last thing I need and my project is done so excited.
I have a formula right now that's =COUNT(FILTER(E5:OV5,LEN(E5:OV5)>4,""))
this works until I add a new row then it changes the OV5 to OV6.
I would like to avoid a formula and use a Vba code to count the claim checks if at all possible because formulas can be accidentally messed with.
A vba code that would count anything number wise or anything 5 digits or more would work
 
Upvote 0
It's a different problem, you should start a new thread.
 
Upvote 0

Forum statistics

Threads
1,214,918
Messages
6,122,257
Members
449,075
Latest member
staticfluids

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