(noob) populate textboxes with data from selected item from listbox

OVV221

New Member
Joined
Oct 18, 2021
Messages
1
Office Version
  1. 365
Platform
  1. Windows
First of all a warning that I am a very big noob with excel vba, but here is a quick explanation of the thing I am working on and where I'm stuck with it.

I need to make a inventory system where users can get information about the software that is in use, add a (new) software and or update already existing software information. I followed tutorial and actually made something half decent (but definitely not done yet), I made a form that automatically pops up when the user opens the excel file, and a second form would open if someone would want to add a application with a control feature witch only adds the application if specific textboxes have been filled in.

so this is the problem, on the first page I have a Listbox with all the applications and a bunch of textboxes, I want that if I select something from the listbox, that the textboxes get filled in with data I have collected in a Master sheet.
so just like in this video @ 2:40
or (search this title: " Inventory Management Template For Store" from the channel "PK: An Excel Expert" if you don't trust clicking links from strangers) I would like that functionality but I don't understand it well enough for it to work with my file.


this is the script from that userform after I tried a bunch of staff but failed:


Option Explicit

Private Sub ListBox1_alleapp_Change()
Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("DATABASE1")




End Sub



Private Sub Textbox1_change()
Call Show_Product
End Sub
Private Sub UserForm_Activate()
Call Show_Product
End Sub

Sub Show_Product()

Dim sh As Worksheet
Set sh = ThisWorkbook.Sheets("DATABASE1")

Dim i As Integer

Me.ListBox1_alleapp.Clear

For i = 2 To Application.WorksheetFunction.CountA(sh.Range("B:B"))
If Me.TextBox1.Value = "" Then
Me.ListBox1_alleapp.AddItem sh.Range("B" & i).Value
Else
If InStr(sh.Range("B" & i).Value, Me.TextBox1.Value) > 0 Then
Me.ListBox1_alleapp.AddItem sh.Range("B" & i).Value
End If
End If
Next i

End Sub


Private Sub CommandButton5_Click()

UserForm1.Show


End Sub
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.

Forum statistics

Threads
1,223,243
Messages
6,170,967
Members
452,371
Latest member
Frana

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