Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Delete Entire Rows

I have the following data in a spreadsheet:

IAN 3025364 3127372008000
FONDA 3025390 3125601110000
FRED 3025390 3125601110000
FRED 3025398 3005703448000
IAN 3025801 3025805491000
IAN 3025801 5805492000000
IAN 3025801 6312140000000
IAN 3025801 5878415000000
IAN 3025801 5878415000000
FRED 5346161 3127382840000
FRED 5346161 3127382284000
IAN 5394701 3127372421000

Is there a way in code to have it delete the rows where
the first set of numbers starts with 302 so the final list
would look like:

FRED 5346161 3127382840000
FRED 5346161 3127382284000
IAN 5394701 3127372421000

It will be looping through worksheets in the workbook and
there are alot of sheets so would like a way to run a
macro to do it. Any help would be appreciated. And
thanks to all those that have been helping me learn
programming in Excel.

Wally Steadman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 46
Default Delete Entire Rows

Wally,
If all the sheets are alike and have data only in columnA to C with a header
row (row1) you can take advantage of the Advanced filter.

Sub Macro4()
Application.ScreenUpdating = False
For i = 1 To Worksheets.Count
Worksheets(i).Activate
LR = Range("A" & Rows.Count).End(xlUp).Row
Range("F3").Formula = "=LEFT(B2,3)<""302"""
With Range("A1:C" & LR)
..Select
..AdvancedFilter _
Action:=xlFilterCopy, _
CriteriaRange:=Range("F2:F3"), _
CopyToRange:=Range("H1:J1"), Unique:=False
End With
Range("A1").Select
Next
Application.ScreenUpdating = True
End Sub

by the way dose anybody know the criteria for Auto filter custom to do the
same job.

Cecil

"Wally Steadman" wrote in message
...
I have the following data in a spreadsheet:

IAN 3025364 3127372008000
FONDA 3025390 3125601110000
FRED 3025390 3125601110000
FRED 3025398 3005703448000
IAN 3025801 3025805491000
IAN 3025801 5805492000000
IAN 3025801 6312140000000
IAN 3025801 5878415000000
IAN 3025801 5878415000000
FRED 5346161 3127382840000
FRED 5346161 3127382284000
IAN 5394701 3127372421000

Is there a way in code to have it delete the rows where
the first set of numbers starts with 302 so the final list
would look like:

FRED 5346161 3127382840000
FRED 5346161 3127382284000
IAN 5394701 3127372421000

It will be looping through worksheets in the workbook and
there are alot of sheets so would like a way to run a
macro to do it. Any help would be appreciated. And
thanks to all those that have been helping me learn
programming in Excel.

Wally Steadman



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 to Delete entire rows by selecting different text in column A Doug[_5_] Excel Discussion (Misc queries) 2 November 20th 09 02:03 PM
Delete an entire row One-Leg Excel Discussion (Misc queries) 13 November 11th 08 08:27 PM
Delete entire row if David T Excel Discussion (Misc queries) 2 December 6th 06 10:14 PM
CANNOT DELETE AN ENTIRE COLUMN ibeetb Excel Discussion (Misc queries) 4 June 23rd 06 02:55 AM
Hide/Delete entire rows based in the content of one cell Clueless Excel Discussion (Misc queries) 2 October 3rd 05 02:40 PM


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