Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default delete all rows not beginning with

Oh! Sorry! It was great my carelessness !
Thnks Lars!
I will try to make amends.

Sub DeleteRows()
Dim i As Integer
Dim rngFound As Range
Dim rngAllRows As Range
Dim astrText() As Variant

On Error Resume Next
astrText = Array("AAAF800", "AAAF900", "AAA1000")
Set rngAllRows = Range("A:A")
For i = LBound(astrText) To UBound(astrText)
Set rngFound = Range("A:A").Find(astrText(i))
If Not rngFound Is Nothing Then
Set rngAllRows = rngAllRows.ColumnDifferences(rngFound)
End If
Set rngFound = Nothing
Next i
rngAllRows.EntireRow.Delete
End Sub




Ο χρήστης "Lars-Åke Aspelin" *γγραψε:

Note that it is "AAA1000" and not "AAAF1000"

Lars-Åke

On Wed, 11 Nov 2009 15:53:01 -0800, John_John
wrote:

Another diferent approach:

Sub DeleteRows()
Dim i As Integer
Dim rngFound As Range
Dim rngAllRows As Range

On Error Resume Next
Set rngAllRows = Range("A:A")
For i = 800 To 1000 Step 100
Set rngFound = Range("A:A").Find("AAAF" & i)
If Not rngFound Is Nothing Then
Set rngAllRows = rngAllRows.ColumnDifferences(rngFound)
End If
Set rngFound = Nothing
Next i
rngAllRows.EntireRow.Delete
End Sub


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
How can I delete a space in the beginning of a cell... GSimone Excel Discussion (Misc queries) 2 April 3rd 23 04:41 PM
How do I set end-of-range to #rows from beginning Jon Charts and Charting in Excel 1 June 27th 09 08:08 PM
Delete space at beginning rexmann Excel Discussion (Misc queries) 4 May 19th 08 12:24 PM
Delete Variable spaces at beginning of a range gmunro Excel Programming 4 August 21st 07 02:26 PM
Delete named ranges beginning with a string GoFigure[_7_] Excel Programming 2 December 4th 05 12:23 PM


All times are GMT +1. The time now is 04:09 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"