Update multiple rows from listbox

  • Thread starter Thread starter staeri
  • Start date Start date
S

staeri

I have a listbox containing 20 rows. Some of them have the same values.


The form containing the listbox also contains a textbox where the user
is able to change a value in the listbox. I want to change this
functionality so that all rows with the same values are updated instead
of a single one.

This is the current code:

Dim lngRowNumber As Long
lngRowNumber = lstObj.ListIndex

'Add 14 to the row number as we start at row 14
Range("B" & (lngRowNumber + 14)).Value = txtChange.Text

Can someone please help me?

Regards,

S
 
Dim lngRowNumber As Long
lngRowNumber = lstObj.ListIndex

'Add 14 to the row number as we start at row 14
oldValue = Range("B" & (lngRowNumber + 14)).Value
for i = 13 to lstObject.Listcount - 1
if cells(i,"B") = oldValue then
cells(i,"B").Value = txtChange.Text
end if
Next i
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top