Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Efficient STRING search with SpecialCells

Hi, all
I need an efficient way to search for cells containing non-numeric
values in column A and then delete the entire row.
Since my worksheet is large (~60,000 rows) I need an inexpensive
method.
I tried using the selection: ".SpecialCells(xlCellTypeConstants,
xlTextValues)" but when I remove a row, all the following rows in the
collection change location and the code misses some of them.

Here is my code:
----------------------------------------
Rng = "a4:a60000"
Set MyRange = Range(Rng)
MyRange.Select
For Each MyCell In Selection.SpecialCells(xlCellTypeConstants,
xlTextValues)
MyCell.Activate
ActiveCell.Rows("1").EntireRow.Select
Selection.Delete Shift:=xlUp
Next MyCell
--------------------------------------

Any ideas?

Thanks
Ilan
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Efficient STRING search with SpecialCells

Rng = "a4:a60000"
Set MyRange = Range(Rng)
MyRange.SpecialCells(xlCellTypeConstants, _
xlTextValues).EntireRow.Delete

This might have problems if there are more than 8192 areas to delete. If
so, post back.

--
Regards,
Tom Ogilvy


"Ilan" wrote in message
om...
Hi, all
I need an efficient way to search for cells containing non-numeric
values in column A and then delete the entire row.
Since my worksheet is large (~60,000 rows) I need an inexpensive
method.
I tried using the selection: ".SpecialCells(xlCellTypeConstants,
xlTextValues)" but when I remove a row, all the following rows in the
collection change location and the code misses some of them.

Here is my code:
----------------------------------------
Rng = "a4:a60000"
Set MyRange = Range(Rng)
MyRange.Select
For Each MyCell In Selection.SpecialCells(xlCellTypeConstants,
xlTextValues)
MyCell.Activate
ActiveCell.Rows("1").EntireRow.Select
Selection.Delete Shift:=xlUp
Next MyCell
--------------------------------------

Any ideas?

Thanks
Ilan



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
search for a string santana New Users to Excel 1 April 23rd 10 03:47 AM
Search for string containing richzip Excel Discussion (Misc queries) 5 January 14th 10 09:49 PM
to search for a string and affect data if it finds the string? Shwaman Excel Worksheet Functions 1 January 11th 06 12:56 AM
Q: search in string JIM.H. Excel Discussion (Misc queries) 5 January 5th 05 10:24 PM
Efficient Search / Find MSNEWS Excel Programming 1 August 27th 03 08:34 AM


All times are GMT +1. The time now is 02:29 PM.

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"