PC Review


Reply
Thread Tools Rate Thread

Deleting zero's within a range?

 
 
Big H
Guest
Posts: n/a
 
      19th Nov 2006
Hi there,

I have a range of data showing positive numbers, negative numbers and zeros.
The range can extend down to row 10000 or more. Is it possible to delete all
zero values within the range say B10:AA10000 and just leave the positive and
negative values.

thanks Harry


 
Reply With Quote
 
 
 
 
Joergen Bondesen
Guest
Posts: n/a
 
      19th Nov 2006
Hi Harry

Try this, please

Option Explicit

Sub DeleteZero()

Dim rrange As Range
Dim cell As Range

Set rrange = ActiveSheet.Range("B10:AA10000")

For Each cell In rrange
If Not cell.HasFormula Then
If Trim(cell.Value) = 0 Then
cell.Value = vbNullString
End If
End If
Next cell
End Sub



--
Best regards
Joergen Bondesen


"Big H" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi there,
>
> I have a range of data showing positive numbers, negative numbers and
> zeros. The range can extend down to row 10000 or more. Is it possible to
> delete all zero values within the range say B10:AA10000 and just leave the
> positive and negative values.
>
> thanks Harry
>



 
Reply With Quote
 
JE McGimpsey
Guest
Posts: n/a
 
      19th Nov 2006
One way:

Public Sub ClearZeros()
Dim rCheck As Range
Dim rCell As Range
On Error Resume Next
Set rCheck = Range("B10:AA10000").SpecialCells _
(xlCellTypeConstants, xlNumbers)
On Error GoTo 0
If Not rCheck Is Nothing Then
For Each rCell In rCheck
With rCell
If .Value = 0 Then .ClearContents
End With
Next rCell
End If
End Sub

In article <(E-Mail Removed)>,
"Big H" <(E-Mail Removed)> wrote:

> Hi there,
>
> I have a range of data showing positive numbers, negative numbers and zeros.
> The range can extend down to row 10000 or more. Is it possible to delete all
> zero values within the range say B10:AA10000 and just leave the positive and
> negative values.
>
> thanks Harry

 
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
Deleting range =?Utf-8?B?T3JsYW5kbw==?= Microsoft Excel Programming 1 7th Sep 2007 04:04 AM
Re: Deleting a range PCLIVE Microsoft Excel Programming 0 9th Jan 2007 04:47 PM
Deleting Range name's listed in the range address box. Satnam Patel Microsoft Excel Misc 4 5th May 2005 01:42 PM
Deleting Range using VB sjbeeny Microsoft Excel Programming 5 29th May 2004 12:14 PM
Range Name deleting Chiller Microsoft Excel Misc 2 24th Aug 2003 10:38 PM


Features
 

Advertising
 

Newsgroups
 


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