LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 57
Default find and findnext


i need to select every cell in coulmn 1 that has a certain string e.g "cat",
then move down until each one is found.
Then following is my attempt!!!!

problem is first cell is never selected and secondly is i need to repeat
code, once with .find and then with .findnext

Can someone please simplify this lot?

Sub FindCat()

Dim CK As Object
Range("A1").Select
ActiveCell.FormulaR1C1 = "CAT"
Range("A2").Select
ActiveCell.FormulaR1C1 = "DOG"
Range("A3").Select
ActiveCell.FormulaR1C1 = "ABIGCAT"
Range("A4").Select
ActiveCell.FormulaR1C1 = "PIG"
Range("A5").Select
ActiveCell.FormulaR1C1 = "NOCAT"
Range("A6").Select
ActiveCell.FormulaR1C1 = "MOUSE"
Range("A7").Select
ActiveCell.FormulaR1C1 = "CAT"
Range("A8").Select

Set CK = Columns(1).Find("CAT")
If Not CK Is Nothing Then
CK.Select
' THEN ASSUME LOTS OF CODE
End If

first% = CK.Row
While CK < ""
Set CK = Columns(1).FindNext(CK) 'try again... as not exact match
If CK Is Nothing Then
End
ElseIf CK < "" Then
CK.Select
' THEN ASSUME LOTS OF CODE
End If
Wend
End Sub


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and FindNext StumpedAgain Excel Programming 3 June 9th 08 06:58 PM
Find / FindNext Trouble DJ Excel Programming 2 May 27th 08 10:16 PM
Using 'Find' and 'FindNext' in vba SA3214 Excel Programming 3 March 25th 05 12:17 PM
Find, Findnext VBA Loop SMS - John Howard Excel Programming 5 November 13th 04 03:19 AM
Find...FindNext Problem mtsark Excel Programming 4 August 19th 04 04:09 PM


All times are GMT +1. The time now is 06:03 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"