Avatar of Massimo Scola
Massimo Scola
Flag for Switzerland asked on

How do I change a value in a row - data displayed in a combobox

I've created a combobox and filled the data with values from a named range, called "Kunden_mit_Adresse". Here is my code:


    'Set reference to the range of data to be filled
    Set rngSourceKunde = Worksheets("Kunden").Range("Kunden_mit_Adresse")
    
    'Fill the listbox
    Set lbtarget = Me.lstKundenListe
    With lbtarget
        'Determine number of columns
        .ColumnCount = 6
        'Set column widths
        .ColumnWidths = "0;130;110;20;0;20"
        'Insert the range of data supplied
        .List = rngSourceKunde.Cells.Value
        
    End With

Open in new window


As you can see, I've created several textboxes. When a customer is selected from the combobox, I wish the data to be displayed in the textfields and be able to change the values (in the spreadsheet).  See attached spreadsheet example.

My goal is that a customer's data can be changed with an Excel userform.

Massimo

example.gif
example.xlsm
Microsoft ExcelMicrosoft Development

Avatar of undefined
Last Comment
ukerandi

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
ukerandi

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Massimo Scola

ASKER
hi ukerandi

It somehow doesn't work. I checked your code:

Private Sub KundeSuchen()
Dim lng As Long
Dim i As Integer

    On Error Resume Next
    lng = frm_daten.ListBox1.Column(5)
End Sub

Open in new window


Private Sub lstKundenListe_Click()
cmbAnrede.Clear
txtKundenName.text = lstKundenListe.text


MsgBox lstKundenListe.text
End Sub

Open in new window


It seems that lstKundenListe.text retrieves the customer's name only. What do I need to do to get, for example, the address? Your code would really help me a lot, as it helps me with other forms I have created.

Thank you
Massimo Scola

ASKER
sorry didn't work :-(
ukerandi

i just saw ure email,
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck