View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default 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