PC Review


Reply
Thread Tools Rate Thread

Delete all non-numerics

 
 
Mrs. Robinson
Guest
Posts: n/a
 
      8th Apr 2009
I'm in the middle of a macro to extrapolate a row of numbers and then use the
numbers as a basis to extrapolate more information. I'm trying to delete all
the blank cells and cells with text in them, leaving behind only the numbers.
Is this possible? The worksheet from which the column is pulled is
formatted as general.

Thanks,
Mrs. Robinson
 
Reply With Quote
 
 
 
 
Bernie Deitrick
Guest
Posts: n/a
 
      8th Apr 2009
Mrs. Robinson,

For column B:

With Range("B:B")
..SpecialCells(xlCellTypeConstants, 2).Delete
..SpecialCells(xlCellTypeBlanks, 2).Delete
End With

HTH,
Bernie
MS Excel MVP


"Mrs. Robinson" <(E-Mail Removed)> wrote in message
news:422F5A48-AA4A-499E-8929-(E-Mail Removed)...
> I'm in the middle of a macro to extrapolate a row of numbers and then use the
> numbers as a basis to extrapolate more information. I'm trying to delete all
> the blank cells and cells with text in them, leaving behind only the numbers.
> Is this possible? The worksheet from which the column is pulled is
> formatted as general.
>
> Thanks,
> Mrs. Robinson



 
Reply With Quote
 
Bernie Deitrick
Guest
Posts: n/a
 
      8th Apr 2009
Sorry, poor copy/paste/edit. The

..SpecialCells(xlCellTypeBlanks, 2).Delete

doesn't need the 2...

HTH,
Bernie
MS Excel MVP


"Bernie Deitrick" <deitbe @ consumer dot org> wrote in message
news:(E-Mail Removed)...
> Mrs. Robinson,
>
> For column B:
>
> With Range("B:B")
> .SpecialCells(xlCellTypeConstants, 2).Delete
> .SpecialCells(xlCellTypeBlanks, 2).Delete
> End With
>
> HTH,
> Bernie
> MS Excel MVP
>
>
> "Mrs. Robinson" <(E-Mail Removed)> wrote in message
> news:422F5A48-AA4A-499E-8929-(E-Mail Removed)...
>> I'm in the middle of a macro to extrapolate a row of numbers and then use the
>> numbers as a basis to extrapolate more information. I'm trying to delete all
>> the blank cells and cells with text in them, leaving behind only the numbers.
>> Is this possible? The worksheet from which the column is pulled is
>> formatted as general.
>>
>> Thanks,
>> Mrs. Robinson

>
>



 
Reply With Quote
 
Jeff
Guest
Posts: n/a
 
      8th Apr 2009
Sub Way()
Dim yourRange As Range
Dim aLastRow As Long
Dim i As Variant

aLastRow = Worksheets(1).Cells(Rows.Count, 1).End(xlUp).Row
Set yourRange = Range("B1:B" & aLastRow)

For Each i In yourRange
If Not IsNumeric(i) Then i.Delete
If IsEmpty(i) Or IsNull(i) Then i.Delete
Next
End Sub


"Mrs. Robinson" wrote:

> I'm in the middle of a macro to extrapolate a row of numbers and then use the
> numbers as a basis to extrapolate more information. I'm trying to delete all
> the blank cells and cells with text in them, leaving behind only the numbers.
> Is this possible? The worksheet from which the column is pulled is
> formatted as general.
>
> Thanks,
> Mrs. Robinson

 
Reply With Quote
 
Capt. Cave Man
Guest
Posts: n/a
 
      8th Apr 2009

Columns, not rows? Are you sure this is what was wanted?

The OP wants a per row, then per cell test, and only delete
(clear)those cells' data. You code appears to delete entire columns.




On Wed, 8 Apr 2009 08:32:18 -0400, "Bernie Deitrick" <deitbe @ consumer
dot org> wrote:

>Mrs. Robinson,
>
>For column B:
>
>With Range("B:B")
>.SpecialCells(xlCellTypeConstants, 2).Delete
>.SpecialCells(xlCellTypeBlanks, 2).Delete
>End With
>
>HTH,
>Bernie
>MS Excel MVP
>
>
>"Mrs. Robinson" <(E-Mail Removed)> wrote in message
>news:422F5A48-AA4A-499E-8929-(E-Mail Removed)...
>> I'm in the middle of a macro to extrapolate a row of numbers and then use the
>> numbers as a basis to extrapolate more information. I'm trying to delete all
>> the blank cells and cells with text in them, leaving behind only the numbers.
>> Is this possible? The worksheet from which the column is pulled is
>> formatted as general.
>>
>> Thanks,
>> Mrs. Robinson

>

 
Reply With Quote
 
Mrs. Robinson
Guest
Posts: n/a
 
      8th Apr 2009
It worked, I see below I used both "column" and "row" ... my mistake. I'm a
techno-geek.

"Capt. Cave Man" wrote:

>
> Columns, not rows? Are you sure this is what was wanted?
>
> The OP wants a per row, then per cell test, and only delete
> (clear)those cells' data. You code appears to delete entire columns.
>
>
>
>
> On Wed, 8 Apr 2009 08:32:18 -0400, "Bernie Deitrick" <deitbe @ consumer
> dot org> wrote:
>
> >Mrs. Robinson,
> >
> >For column B:
> >
> >With Range("B:B")
> >.SpecialCells(xlCellTypeConstants, 2).Delete
> >.SpecialCells(xlCellTypeBlanks, 2).Delete
> >End With
> >
> >HTH,
> >Bernie
> >MS Excel MVP
> >
> >
> >"Mrs. Robinson" <(E-Mail Removed)> wrote in message
> >news:422F5A48-AA4A-499E-8929-(E-Mail Removed)...
> >> I'm in the middle of a macro to extrapolate a row of numbers and then use the
> >> numbers as a basis to extrapolate more information. I'm trying to delete all
> >> the blank cells and cells with text in them, leaving behind only the numbers.
> >> Is this possible? The worksheet from which the column is pulled is
> >> formatted as general.
> >>
> >> Thanks,
> >> Mrs. Robinson

> >

>

 
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
Extract Numerics only =?Utf-8?B?Q29yZXk=?= Microsoft Excel Misc 41 9th Jan 2008 10:16 PM
Re: Alpha Numerics #3 John Vinson Microsoft Access 0 14th Apr 2005 09:35 PM
Using Alpha/Numerics =?Utf-8?B?SE9UIEZMQVNI?= Microsoft Access Database Table Design 2 30th Mar 2005 03:19 PM
Disables numerics Karen Crossley Windows XP Basics 6 9th Feb 2005 10:24 PM
Numerics John Fourkiotis Microsoft C# .NET 4 16th Nov 2004 09:05 PM


Features
 

Advertising
 

Newsgroups
 


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