#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Delete rows

I have a sheet with (extract from ERP system) with about 30,000 rows. I need
to delete a lot of them (once a week). Tried the following formula:
=IF(AND(ISNUMBER(C2412),NOT(ISTEXT(B2412))),"","x" )
copied to for example AA1:AA30.000 to get 'x' in rows to be deleted.
Then I use AutoFilter to find all 'x' and try to delete all these rows, but
my Excel to freezes.

Next I wanted to use Ron de Bruin's code
http://www.rondebruin.nl/delete.htm

but I am not sure how to change the code to have it delete rows which both
have a number in column C and where column B is not text. Am I right that
Ron's code is optimized for speed?

Hans Knudsen

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Delete rows

One more thing:
What should the code look like if I want to delete all rows which not hold a
seven digit number in column C?
Hans


"Hans Knudsen" wrote in message
...
I have a sheet with (extract from ERP system) with about 30,000 rows. I
need to delete a lot of them (once a week). Tried the following formula:
=IF(AND(ISNUMBER(C2412),NOT(ISTEXT(B2412))),"","x" )
copied to for example AA1:AA30.000 to get 'x' in rows to be deleted.
Then I use AutoFilter to find all 'x' and try to delete all these rows,
but my Excel to freezes.

Next I wanted to use Ron de Bruin's code
http://www.rondebruin.nl/delete.htm

but I am not sure how to change the code to have it delete rows which both
have a number in column C and where column B is not text. Am I right that
Ron's code is optimized for speed?

Hans Knudsen


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default Delete rows

To me nothing seems to happen when I run this procedure, and I have not
changed anything neither in my sheet nor in your code.
Hans


"Mike H" wrote in message
...
Hi,

I'd use a macro for this. Right click the sheet tab, view code and paste
this in and run it.

Sub Stantial()
Dim MyRange As Range
Dim copyrange As Range
Lastrow = Cells(Cells.Rows.Count, "B").End(xlUp).Row
Set MyRange = Range("B1:B" & Lastrow)
For Each c In MyRange
If Not WorksheetFunction.IsText(c.Value) And Not IsEmpty(c.Offset(, 1))
And
IsNumeric(c.Offset(, 1)) Then
If copyrange Is Nothing Then
Set copyrange = c.EntireRow
Else
Set copyrange = Union(copyrange, c.EntireRow)
End If
End If
Next
If Not copyrange Is Nothing Then
copyrange.EntireRow.Delete
End If

End Sub

Mike

"Hans Knudsen" wrote:

One more thing:
What should the code look like if I want to delete all rows which not
hold a
seven digit number in column C?
Hans


"Hans Knudsen" wrote in message
...
I have a sheet with (extract from ERP system) with about 30,000 rows. I
need to delete a lot of them (once a week). Tried the following formula:
=IF(AND(ISNUMBER(C2412),NOT(ISTEXT(B2412))),"","x" )
copied to for example AA1:AA30.000 to get 'x' in rows to be deleted.
Then I use AutoFilter to find all 'x' and try to delete all these rows,
but my Excel to freezes.

Next I wanted to use Ron de Bruin's code
http://www.rondebruin.nl/delete.htm

but I am not sure how to change the code to have it delete rows which
both
have a number in column C and where column B is not text. Am I right
that
Ron's code is optimized for speed?

Hans Knudsen



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
Hpw do I delete multiple empty rows found between filled rows? Bill Excel Worksheet Functions 2 November 15th 09 07:12 PM
Delete Rows if any cell in Column H is blank but do not Delete Fir manfareed Excel Programming 4 September 28th 07 05:20 PM
Copy pasting Rows, but need to Delete any Shapes/Pictures that are within copied rows Corey Excel Programming 2 August 1st 07 02:02 AM
How to delete rows when List toolbar's "delete" isnt highlighted? Linda Excel Worksheet Functions 1 May 26th 05 08:39 PM
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below Annette[_4_] Excel Programming 2 September 21st 04 02:40 PM


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

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"