Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro analyses Cell . If text found , delets entire row
I have a table with many columns and rows . Tha Macro should search if cells
from C column contain text . If yes , it delets entire row . |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro analyses Cell . If text found , delets entire row
Something like this:
Sub rowkiller() Dim s As String, n As Long, i As Long s = "text" n = Cells(Rows.Count, 3).End(xlUp).Row For i = n To 1 Step -1 If InStr(Cells(i, 3).Value, s) 0 Then Rows(i).Delete End If Next End Sub -- Gary''s Student - gsnu200906 "andrei" wrote: I have a table with many columns and rows . Tha Macro should search if cells from C column contain text . If yes , it delets entire row . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro analyses Cell . If text found , delets entire row
I didn't take your "text" to mean the word "text". I think you meant any
text not including a numeric entry. The following macro will do what you want. HTH Otto Sub DelCText() Dim rColC As Range Dim c As Long Set rColC = Range("C2", Range("C" & Rows.Count).End(xlUp)) For c = rColC(rColC.Count) To 1 Step -1 If rColC(c) < "" And _ Not IsNumeric(rColC(c)) Then _ rColC(c).EntireRow.Delete Next c End Sub "andrei" wrote in message ... I have a table with many columns and rows . Tha Macro should search if cells from C column contain text . If yes , it delets entire row . |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro analyses Cell . If text found , delets entire row
Yep , i meant any text not including numeric entry
The macro gives a type mismatch for : For c = rColC(rColC.Count) To 1 Step -1 @Gary''s Student I tried your macro , also . But it nothing happens "Otto Moehrbach" wrote: I didn't take your "text" to mean the word "text". I think you meant any text not including a numeric entry. The following macro will do what you want. HTH Otto Sub DelCText() Dim rColC As Range Dim c As Long Set rColC = Range("C2", Range("C" & Rows.Count).End(xlUp)) For c = rColC(rColC.Count) To 1 Step -1 If rColC(c) < "" And _ Not IsNumeric(rColC(c)) Then _ rColC(c).EntireRow.Delete Next c End Sub |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro analyses Cell . If text found , delets entire row
Yes, my mistake. Change it to: Otto
For c = rColC.Count To 1 Step -1 "andrei" wrote in message ... Yep , i meant any text not including numeric entry The macro gives a type mismatch for : For c = rColC(rColC.Count) To 1 Step -1 @Gary''s Student I tried your macro , also . But it nothing happens "Otto Moehrbach" wrote: I didn't take your "text" to mean the word "text". I think you meant any text not including a numeric entry. The following macro will do what you want. HTH Otto Sub DelCText() Dim rColC As Range Dim c As Long Set rColC = Range("C2", Range("C" & Rows.Count).End(xlUp)) For c = rColC(rColC.Count) To 1 Step -1 If rColC(c) < "" And _ Not IsNumeric(rColC(c)) Then _ rColC(c).EntireRow.Delete Next c End Sub |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro analyses Cell . If text found , delets entire row
This version removes rows with any text in column C:
Sub rowkiller2() Dim n As Long, i As Long n = Cells(Rows.Count, 3).End(xlUp).Row For i = n To 1 Step -1 If IsNumeric(Cells(i, 3).Value) Then Else Rows(i).Delete End If Next End Sub -- Gary''s Student - gsnu200906 "andrei" wrote: Yep , i meant any text not including numeric entry The macro gives a type mismatch for : For c = rColC(rColC.Count) To 1 Step -1 @Gary''s Student I tried your macro , also . But it nothing happens "Otto Moehrbach" wrote: I didn't take your "text" to mean the word "text". I think you meant any text not including a numeric entry. The following macro will do what you want. HTH Otto Sub DelCText() Dim rColC As Range Dim c As Long Set rColC = Range("C2", Range("C" & Rows.Count).End(xlUp)) For c = rColC(rColC.Count) To 1 Step -1 If rColC(c) < "" And _ Not IsNumeric(rColC(c)) Then _ rColC(c).EntireRow.Delete Next c End Sub |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro analyses Cell . If text found , delets entire row
Many thanks guys
Both macro work ! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro that analyses data from 3 columns and puts result in 4th | Excel Programming | |||
Macro that delets all cells containg ALL words in bold | Excel Programming | |||
macro which delets cell if the cell above has the same keyword | Excel Programming | |||
Macro which searches for a character . When found delets what's be | Excel Programming | |||
Highlight found text string in cell? | Excel Programming |