![]() |
Update multiple rows from listbox
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 |
Update multiple rows from listbox
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 -- Regards, Tom Ogilvy " wrote: 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 |
All times are GMT +1. The time now is 04:42 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com