PC Review


Reply
Thread Tools Rate Thread

Delete row if cell in column "E" has 1 or more alpha characters

 
 
Peruanos72
Guest
Posts: n/a
 
      15th Apr 2009
I'm trying to delete rows of data after row 4 if the cell in column "E" has
any alpha characters in it at all. If the cell in column "E" is all numeric
then no action is taken on that row. Thoughts??
 
Reply With Quote
 
 
 
 
Tushar Mehta
Guest
Posts: n/a
 
      15th Apr 2009
This is probably OK with the OP but it does delete rows where the corr. col E
cell contains a string with only numbers. For example, it deletes a row with
'5 in the corresponding col. E cell.

--
Tushar Mehta
http://www.tushar-mehta.com
Custom business solutions leveraging a multi-disciplinary approach
In Excel 2007 double-click to format may not work; right click and select
from the menu


"Rick Rothstein" wrote:

> Assuming you are running this code in the ActiveSheet (so that the Range is
> referenced correctly), then this statement should do what you want...
>
> Range("E5:E" & Rows.Count).SpecialCells(xlCellTypeConstants, _
> xlTextValues).EntireRow.Delete
>
> You can put it into a macro or execute it from the Immediate window.
>
> --
> Rick (MVP - Excel)
>
>
> "Peruanos72" <(E-Mail Removed)> wrote in message
> news:E25912F8-B704-4C36-A211-(E-Mail Removed)...
> > I'm trying to delete rows of data after row 4 if the cell in column "E"
> > has
> > any alpha characters in it at all. If the cell in column "E" is all
> > numeric
> > then no action is taken on that row. Thoughts??

>
>

 
Reply With Quote
 
Rick Rothstein
Guest
Posts: n/a
 
      16th Apr 2009
Good point! I had forgotten about that.

--
Rick (MVP - Excel)


"Tushar Mehta" <(E-Mail Removed)> wrote in
message news:8338EA9B-E392-4472-84DA-(E-Mail Removed)...
> This is probably OK with the OP but it does delete rows where the corr.
> col E
> cell contains a string with only numbers. For example, it deletes a row
> with
> '5 in the corresponding col. E cell.
>
> --
> Tushar Mehta
> http://www.tushar-mehta.com
> Custom business solutions leveraging a multi-disciplinary approach
> In Excel 2007 double-click to format may not work; right click and select
> from the menu
>
>
> "Rick Rothstein" wrote:
>
>> Assuming you are running this code in the ActiveSheet (so that the Range
>> is
>> referenced correctly), then this statement should do what you want...
>>
>> Range("E5:E" & Rows.Count).SpecialCells(xlCellTypeConstants, _
>> xlTextValues).EntireRow.Delete
>>
>> You can put it into a macro or execute it from the Immediate window.
>>
>> --
>> Rick (MVP - Excel)
>>
>>
>> "Peruanos72" <(E-Mail Removed)> wrote in message
>> news:E25912F8-B704-4C36-A211-(E-Mail Removed)...
>> > I'm trying to delete rows of data after row 4 if the cell in column "E"
>> > has
>> > any alpha characters in it at all. If the cell in column "E" is all
>> > numeric
>> > then no action is taken on that row. Thoughts??

>>
>>


 
Reply With Quote
 
Peruanos72
Guest
Posts: n/a
 
      17th Apr 2009
This worked beautifully. Thx!!!

"Per Jessen" wrote:

> Try this:
>
> Sub DeleteNonNumericRows()
> LastRow = Range("E" & Rows.Count).End(xlUp).Row
> For r = LastRow To 4 Step -1
> If Not IsNumeric(Cells(r, "E")) Then
> Rows(r).Delete
> End If
> Next
> End Sub
>
> Hopes this helps.
>
> ---
> Per
>
> "Peruanos72" <(E-Mail Removed)> skrev i meddelelsen
> news:E25912F8-B704-4C36-A211-(E-Mail Removed)...
> > I'm trying to delete rows of data after row 4 if the cell in column "E"
> > has
> > any alpha characters in it at all. If the cell in column "E" is all
> > numeric
> > then no action is taken on that row. Thoughts??

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Delete row if cell in column "E" has 1 or more alpha characters Rick Rothstein Microsoft Excel Programming 0 15th Apr 2009 10:09 PM
RE: Delete row if cell in column "E" has 1 or more alpha characters Tushar Mehta Microsoft Excel Programming 0 15th Apr 2009 09:44 PM
Re: Delete row if cell in column "E" has 1 or more alpha characters Per Jessen Microsoft Excel Programming 0 15th Apr 2009 09:42 PM
Count unique alpha numeric "characters" in a common cell =?Utf-8?B?V0lNNDI0Ng==?= Microsoft Excel Worksheet Functions 4 11th Dec 2004 02:27 AM
Re: "SUMIF" or "COUNTIF" to count alpha characters as .5 ? Angela Microsoft Excel Discussion 1 18th Sep 2004 01:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:07 PM.