Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to Delete entire rows by selecting different text in column A | Excel Discussion (Misc queries) | |||
Delete an entire row | Excel Discussion (Misc queries) | |||
Delete entire row if | Excel Discussion (Misc queries) | |||
CANNOT DELETE AN ENTIRE COLUMN | Excel Discussion (Misc queries) | |||
Hide/Delete entire rows based in the content of one cell | Excel Discussion (Misc queries) |