View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Loop through cells

For i = 4 To 135
If Cells(i,"A").Value = ListOld.Value Then
Cells(i,"A").Offset(0,1).Value = "Old"
End If
Next i



--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"Sheeny " wrote in message
...
Hi,
Im an amateur in the Excel/ VB world and could really appreciate some
help here. Here's what Im doing.

Based on what a user selects in a list box, I want Excel to search
througuh all the records in column A (range A4:A135) and if an entry in
column A matches the section from the list, to print 'Old' in the next
column, same row.

Here's what I have:

Private Sub CmdIdentifyOld_Click()
Sheet2.Activate
Sheet2.Range("A3").Select

For i = 1 To 135
If ActiveCell.Text = ListOld.Value Then
ActiveCell.Next.Value = "Old"
Else
ActiveCell = ActiveCell.Offset(0, 1)
End If
Next i


End Sub

-------------------------------------------------------------------------

However, this doesn't really do much.
It does go to teh second worksheet and cell A3. However it doesnt loop
through the cells and match a value - it simply deletes the value in
A3.

Any help will be GREATLY appreciated.

Thanks!


---
Message posted from http://www.ExcelForum.com/