Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi, i need a macro to delete rows that don't have in "H" column the name "John"
If in "H" column the code finds anything else, then to delete row. Can this be done? Thanks! |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi,
One approach might be: ================= Sub John() LR = [H65536].End(xlUp).Row For R = LR To 1 Step -1 If Cells(R, 8) < "John" Then Cells(R, 8).EntireRow.Delete Next End Sub ======== Micky "puiuluipui" wrote: Hi, i need a macro to delete rows that don't have in "H" column the name "John" If in "H" column the code finds anything else, then to delete row. Can this be done? Thanks! |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Hi
'Delete if not cell match Sub DeleteRows() Dim lngRow As Long For lngRow = Cells(Rows.Count, "H").End(xlUp).Row To 1 Step -1 If StrComp(Range("H" & lngRow), "John", vbTextCompare) < 0 Then Rows(lngRow).Delete End If Next End Sub 'delete rows if the word 'john' is not found within the cell Sub DeleteRows() Dim lngRow As Long For lngRow = Cells(Rows.Count, "H").End(xlUp).Row To 1 Step -1 If InStr(1, Range("H" & lngRow), "john", vbTextCompare) = 0 Then Rows(lngRow).Delete End If Next End Sub -- Jacob "puiuluipui" wrote: Hi, i need a macro to delete rows that don't have in "H" column the name "John" If in "H" column the code finds anything else, then to delete row. Can this be done? Thanks! |
#4
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]() sub delifnotjohn()'if John is not within other text for i=cells(rows.count,"H").end(xlup).row to 1 step -1 if ucase(cells(i,"h"))<"JOHN" then rows(i).delete next i end sub -- Don Guillett Microsoft MVP Excel SalesAid Software "puiuluipui" wrote in message ... Hi, i need a macro to delete rows that don't have in "H" column the name "John" If in "H" column the code finds anything else, then to delete row. Can this be done? Thanks! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro warning - how to delete macro | Excel Worksheet Functions | |||
Cannot Delete Macro | New Users to Excel | |||
delete a macro that isn't in macro list | Excel Discussion (Misc queries) | |||
How can I delete a macro when the Delete button is not active? | Excel Worksheet Functions | |||
How do i delete a macro in Excel 2003 when delete isn't highlight | Excel Discussion (Misc queries) |