Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Delete rows with specific leftmost value

Hi All..........

I have a file that I am importing by macro and it comes in all in column
A........I know how to separate the columns with a SPACE delimiter, but
before doing that, I would like to delete all rows that begin with a
specific order of characters, (space space SUPPL), by having a macro read
column A and do the deletions.........if someone would be so
kind.............

TIA
Vaya con Dios,
Chuck, CABGx3



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default Delete rows with specific leftmost value

Put this in a general code module.

Sub DeleteRow()
Dim R As Long
Dim C As Range
Dim Rng As Range

Set Rng = ActiveSheet.UsedRange.Rows
For R = Rng.Rows.Count To 1 Step -1
Set C = Range("A" & R)
If Left(C, 7) = " SUPPL" Then
Rng.Rows(R).EntireRow.Delete
End If
Next R
End Sub

Mike F
"CLR" wrote in message
...
Hi All..........

I have a file that I am importing by macro and it comes in all in column
A........I know how to separate the columns with a SPACE delimiter, but
before doing that, I would like to delete all rows that begin with a
specific order of characters, (space space SUPPL), by having a macro read
column A and do the deletions.........if someone would be so
kind.............

TIA
Vaya con Dios,
Chuck, CABGx3





  #3   Report Post  
Posted to microsoft.public.excel.programming
CLR CLR is offline
external usenet poster
 
Posts: 594
Default Delete rows with specific leftmost value

Outstanding Mike...........your code works like a charm.........

Thank you very much!

Vaya con Dios,
Chuck, CABGx3


"Mike Fogleman" wrote in message
...
Put this in a general code module.

Sub DeleteRow()
Dim R As Long
Dim C As Range
Dim Rng As Range

Set Rng = ActiveSheet.UsedRange.Rows
For R = Rng.Rows.Count To 1 Step -1
Set C = Range("A" & R)
If Left(C, 7) = " SUPPL" Then
Rng.Rows(R).EntireRow.Delete
End If
Next R
End Sub

Mike F
"CLR" wrote in message
...
Hi All..........

I have a file that I am importing by macro and it comes in all in column
A........I know how to separate the columns with a SPACE delimiter, but
before doing that, I would like to delete all rows that begin with a
specific order of characters, (space space SUPPL), by having a macro

read
column A and do the deletions.........if someone would be so
kind.............

TIA
Vaya con Dios,
Chuck, CABGx3







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
Delete rows with specific text David New Users to Excel 5 April 3rd 23 07:29 PM
Delete Rows Without Specific Text waggett Excel Worksheet Functions 6 October 6th 09 11:34 AM
Delete specific rows of data Roger Bell New Users to Excel 3 June 19th 07 08:40 AM
Delete rows if specific criteria not met. SITCFanTN Excel Worksheet Functions 3 July 5th 06 12:20 AM
Macro to delete specific rows Steve Excel Programming 12 October 1st 04 11:50 PM


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