View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Brian Taylor Brian Taylor is offline
external usenet poster
 
Posts: 52
Default Search Column then Paste Data at end of Row?

Did you switch out the search string for what you were looking for? I
put "b" in as my search string.

To manipulate the ozgrid code to do what you want, you would just need
to use the range variable rFoundCell. Something like this:

sub IsntThisSwell

Dim lCount As Long
Dim rFoundCell As Range
Dim strSearch as String

strSearch = "Whatever it is you are looking for"
Set rFoundCell = Range("A1") 'This should be the first cell in the
range you are looking in

For lCount = 1 To WorksheetFunction.CountIf(Columns(1), strSearch)
Set rFoundCell = Columns(1).Find(What:=strSearch, _
After:=rFoundCell, LookIn:=xlValues, LookAt:=xlPart, _
SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False)
With rFoundCell
Range("Q" & .Row).Value = var1
Range("R" & .Row).Value = var2
Range("S" & .Row).Value = lCount 'this is a running tally of
hits
End With
Next lCount

End Sub