Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
I have a spreadsheet with the following data in a column:
C100 C101 MTH1 MTH2 R1 R2 TP1 TP2 I wish to delete all rows that contain MTH or TP in that column. A macro to do this would be great. -- Thanks Slohcin |
#2
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Sub demo()
s1 = "MTH" s2 = "TP" For i = 1000 To 1 Step -1 v = Cells(i, "A").Value If InStr(v, s1) Or InStr(v, s2) Then Cells(i, "A").EntireRow.Delete End If Next End Sub This is coded for column A and 1000 rows, adjust as you require. -- Gary's Student "Slohcin" wrote: I have a spreadsheet with the following data in a column: C100 C101 MTH1 MTH2 R1 R2 TP1 TP2 I wish to delete all rows that contain MTH or TP in that column. A macro to do this would be great. -- Thanks Slohcin |
#3
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Thanks Gary, that worked OK.
-- Thanks Slohcin "Gary''s Student" wrote: Sub demo() s1 = "MTH" s2 = "TP" For i = 1000 To 1 Step -1 v = Cells(i, "A").Value If InStr(v, s1) Or InStr(v, s2) Then Cells(i, "A").EntireRow.Delete End If Next End Sub This is coded for column A and 1000 rows, adjust as you require. -- Gary's Student "Slohcin" wrote: I have a spreadsheet with the following data in a column: C100 C101 MTH1 MTH2 R1 R2 TP1 TP2 I wish to delete all rows that contain MTH or TP in that column. A macro to do this would be great. -- Thanks Slohcin |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
unable to filter by specific data on a column if the rows exceed 1 | Excel Worksheet Functions | |||
macro | Excel Discussion (Misc queries) | |||
Excel Macro to Copy & Paste | Excel Worksheet Functions | |||
Delete rows with no data | Setting up and Configuration of Excel | |||
Extract specific data into its own workbook via macro? | Excel Discussion (Misc queries) |