Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Deleting zero's within a range?

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 110
Default Deleting zero's within a range?

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" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default Deleting zero's within a range?

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 ,
"Big H" 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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
why can't hide zero's based on a zero valuer in range Todd F.[_2_] Excel Programming 5 March 13th 06 07:47 PM
Deleting Range name's listed in the range address box. Satnam Patel Excel Discussion (Misc queries) 4 May 5th 05 01:42 PM
deleting cells in a range JulieD Excel Programming 5 March 25th 05 02:03 AM
Deleting Range using VB sjbeeny Excel Programming 5 May 29th 04 12:14 PM
Deleting range not a row Robert[_13_] Excel Programming 3 September 1st 03 11:12 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"