T
teatree
i've a worksheet, and in column one, i've got a range that contains on
of the following:
TOTAL Employees
firstname, lastname
NAME
or a blank row
i'm using Instr to find the commas, and if it fails, i want it t
delete the entire row. so that i have a list of firstname, lastname
only.
when i run my code once
it deletes all occurrances of TOTAL Employees
i run it again, it removes the blank rows
again, and it cuts out all the NAME cells
can anyone help me get them all with one pass?
'begin code
Sub Clipped()
fc = "A3"
'column C is the only column with continuous data all
'the way down...
lr = Range("C3").End(xlDown).Row
lc = "A" & lr
Range(fc, lc).Select
For Each cll In Selection
iscomma = InStr(cll.Value, ",")
If iscomma = 0 Then
Range(cll.Address).EntireRow.Delete
End If
Next cll
End Sub
'end code
what i've tried:
a case statement in lieu of IF ...Then, Case ing on "0", Null and Cas
Else
subbing "," with Chr(44)
Having instr look for " ,"
always the same result
i'm using Excel 97 on Win 98.
strangely i modified this only slightly to remove middle initials
which were stuck on the end of the lastname:
Public, John Q.
run this same loop on "."
and it grabs them all, every time.
but then i'm keeping/modifying the text, not deleting the row
of the following:
TOTAL Employees
firstname, lastname
NAME
or a blank row
i'm using Instr to find the commas, and if it fails, i want it t
delete the entire row. so that i have a list of firstname, lastname
only.
when i run my code once
it deletes all occurrances of TOTAL Employees
i run it again, it removes the blank rows
again, and it cuts out all the NAME cells
can anyone help me get them all with one pass?
'begin code
Sub Clipped()
fc = "A3"
'column C is the only column with continuous data all
'the way down...
lr = Range("C3").End(xlDown).Row
lc = "A" & lr
Range(fc, lc).Select
For Each cll In Selection
iscomma = InStr(cll.Value, ",")
If iscomma = 0 Then
Range(cll.Address).EntireRow.Delete
End If
Next cll
End Sub
'end code
what i've tried:
a case statement in lieu of IF ...Then, Case ing on "0", Null and Cas
Else
subbing "," with Chr(44)
Having instr look for " ,"
always the same result
i'm using Excel 97 on Win 98.
strangely i modified this only slightly to remove middle initials
which were stuck on the end of the lastname:
Public, John Q.
run this same loop on "."
and it grabs them all, every time.
but then i'm keeping/modifying the text, not deleting the row