#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default search data

I need to seach a cell range (C2: C last cell) for a specific string. Once
found i need to delete the entire row and continue searching. Can someone
help me with this? Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default search data

search help for find next.

--


Gary Keramidas
Excel 2003


"Daniel M" wrote in message
...
I need to seach a cell range (C2: C last cell) for a specific string. Once
found i need to delete the entire row and continue searching. Can someone
help me with this? Thanks.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 434
Default search data

hi, Daniel !

I need to seach a cell range (C2: C last cell) for a specific string.
Once found i need to delete the entire row and continue searching.
Can someone help me with this? Thanks.


regarding this "specific" string...
- is (upp/low)er case important ?
- is it a start-string, middle-string, end-string ?
- how many do you expect to be found ? (1, 10, 100, 1000, ...)

(just trying to be in "specific" help to you) :D

regards,
hector.


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8,520
Default search data

Hi Daniel

Try out the below

Sub Macro()
Dim varFound As Range, varSearch As String

varSearch = "jac"

With Range("C2:C" & Cells(Rows.Count, "C").End(xlUp).Row)
Set varFound = .Find(varSearch, LookIn:=xlValues, SearchDirection:=xlPrevious)
Do While Not varFound Is Nothing
varFound.EntireRow.Delete
Set varFound = .Find(varSearch, LookIn:=xlValues, SearchDirection:=xlPrevious)
Loop
End With
End Sub

Check out help on Range.Find and adjust the code
LookAt Optional Variant. Can be one of the following XlLookAt constants:
xlWhole or xlPart

--
Jacob


"Daniel M" wrote:

I need to seach a cell range (C2: C last cell) for a specific string. Once
found i need to delete the entire row and continue searching. Can someone
help me with this? Thanks.

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default search data

This worked perfectly. I was looking at the .find help but was having
problems with the syntext. Thank you!

"Jacob Skaria" wrote:

Hi Daniel

Try out the below

Sub Macro()
Dim varFound As Range, varSearch As String

varSearch = "jac"

With Range("C2:C" & Cells(Rows.Count, "C").End(xlUp).Row)
Set varFound = .Find(varSearch, LookIn:=xlValues, SearchDirection:=xlPrevious)
Do While Not varFound Is Nothing
varFound.EntireRow.Delete
Set varFound = .Find(varSearch, LookIn:=xlValues, SearchDirection:=xlPrevious)
Loop
End With
End Sub

Check out help on Range.Find and adjust the code
LookAt Optional Variant. Can be one of the following XlLookAt constants:
xlWhole or xlPart

--
Jacob


"Daniel M" wrote:

I need to seach a cell range (C2: C last cell) for a specific string. Once
found i need to delete the entire row and continue searching. Can someone
help me with this? Thanks.

Reply
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
Data Search amboo_radley Excel Programming 3 November 21st 08 04:43 PM
search data? kyoshirou Excel Discussion (Misc queries) 6 June 1st 07 09:34 AM
Data Search Airfive Excel Discussion (Misc queries) 3 May 11th 07 01:53 AM
Data Search Airfive Excel Worksheet Functions 2 November 20th 06 06:43 PM
Search through Data adz New Users to Excel 1 October 5th 06 07:39 AM


All times are GMT +1. The time now is 12:50 AM.

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

About Us

"It's about Microsoft Excel"