#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default no blank cells

Need to know a formula to remove blank cells or cells containing 0.
eg
A
21
0
33
44
0
What I'm looking for are
A
21
33
44
No zero or blank cells.

thx

  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default no blank cells

There are two ways that I know of to take away the blank cells, I dont know
about the zeros...

Manually you can do this by

Edit Go To Special Blanks
Edit Delete Shift Entire Row

That is starting on A1

There is a code as well

Option Explicit
Sub testme01()

Dim myRng As Range

With ActiveSheet
Set myRng = Nothing
On Error Resume Next
Set myRng = .Range("a:a").Cells.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

If myRng Is Nothing Then
MsgBox "no blanks in column A"
Exit Sub
End If

Intersect(myRng.EntireRow, .Columns("A:P")) _
.Cells.SpecialCells(xlCellTypeBlanks).Delete shift:=xlUp
End With
End Sub

test it, select the column and play that macro

--
If this reply was helpful, please indicate that your question has been
answered to help others find anwsers to similar questions.

www.silverbirddesigns.com

Fighting Texas Aggie Class of 2009


"ekkeindoha" wrote:

Need to know a formula to remove blank cells or cells containing 0.
eg
A
21
0
33
44
0
What I'm looking for are
A
21
33
44
No zero or blank cells.

thx

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 185
Default no blank cells

If you want to permanently delete them, sort the data and delete all the
rows with '0'

If you want to hide them temporarily, check out DataFilterAutofilter

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk

UK Excel User Conference In Cambridge
November 28th - December 1st 2007
Register Now @ http://www.exceluserconference.com/UKEUC.html



"ekkeindoha" wrote in message
...
Need to know a formula to remove blank cells or cells containing 0.
eg
A
21
0
33
44
0
What I'm looking for are
A
21
33
44
No zero or blank cells.

thx

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default no blank cells

If you want to delete the Blank Cells and Zeros, here is the complete code,
asuming that your data is in column A

Option Explicit
Sub testme01()

Dim rng As Range, cell As Range
Dim rng1 As Range
On Error Resume Next
Set rng = ActiveSheet.UsedRange.SpecialCells(xlConstants, xlNumbers)
Set rng1 = ActiveSheet.UsedRange.SpecialCells(xlFormulas, xlNumbers)
On Error GoTo 0
If Not rng Is Nothing Then
For Each cell In rng
If cell.Value = 0 Then cell.ClearContents
Next
End If
If Not rng1 Is Nothing Then
For Each cell In rng1
If cell.Value = 0 Then cell.ClearContents
Next
End If

Dim myRng As Range

With ActiveSheet
Set myRng = Nothing
On Error Resume Next
Set myRng = .Range("a:a").Cells.SpecialCells(xlCellTypeBlanks)
On Error GoTo 0

If myRng Is Nothing Then
MsgBox "no blanks in column A"
Exit Sub
End If

Intersect(myRng.EntireRow, .Columns("A:P")) _
.Cells.SpecialCells(xlCellTypeBlanks).Delete shift:=xlUp
End With
End Sub





--
If this reply was helpful, please indicate that your question has been
answered to help others find anwsers to similar questions.

www.silverbirddesigns.com

Fighting Texas Aggie Class of 2009


"ekkeindoha" wrote:

Need to know a formula to remove blank cells or cells containing 0.
eg
A
21
0
33
44
0
What I'm looking for are
A
21
33
44
No zero or blank cells.

thx

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 74
Default no blank cells

Nick,

If you sort them and delete, how do you plan on getting them back to the
order in which they were in? Sorry, just curious.


--
If this reply was helpful, please indicate that your question has been
answered to help others find anwsers to similar questions.

www.silverbirddesigns.com

Fighting Texas Aggie Class of 2009


"Nick Hodge" wrote:

If you want to permanently delete them, sort the data and delete all the
rows with '0'

If you want to hide them temporarily, check out DataFilterAutofilter

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk

UK Excel User Conference In Cambridge
November 28th - December 1st 2007
Register Now @ http://www.exceluserconference.com/UKEUC.html



"ekkeindoha" wrote in message
...
Need to know a formula to remove blank cells or cells containing 0.
eg
A
21
0
33
44
0
What I'm looking for are
A
21
33
44
No zero or blank cells.

thx




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3,268
Default no blank cells

You could use a filter and filter out blanks and zeros and then copy and
paste the result


--


Regards,


Peo Sjoblom


"Texas Aggie" wrote in message
...
Nick,

If you sort them and delete, how do you plan on getting them back to the
order in which they were in? Sorry, just curious.


--
If this reply was helpful, please indicate that your question has been
answered to help others find anwsers to similar questions.

www.silverbirddesigns.com

Fighting Texas Aggie Class of 2009


"Nick Hodge" wrote:

If you want to permanently delete them, sort the data and delete all the
rows with '0'

If you want to hide them temporarily, check out DataFilterAutofilter

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
DTHIS
web:
www.nickhodge.co.uk

UK Excel User Conference In Cambridge
November 28th - December 1st 2007
Register Now @ http://www.exceluserconference.com/UKEUC.html



"ekkeindoha" wrote in message
...
Need to know a formula to remove blank cells or cells containing 0.
eg
A
21
0
33
44
0
What I'm looking for are
A
21
33
44
No zero or blank cells.

thx




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
Index/match - make blank cells return a blank value. diaare Excel Worksheet Functions 3 May 3rd 23 03:44 AM
Maximum Number of Blank Cells between Non Blank Cells in a Range Mal Excel Worksheet Functions 5 November 3rd 07 08:21 AM
How to count blank cells (Rows) between Non-Blank cells in Col "A" Dennis Excel Discussion (Misc queries) 8 July 20th 06 11:25 PM
Imported Data creates blank cells that aren't really blank JackieD Excel Worksheet Functions 14 February 23rd 06 12:57 AM
Making Blank Cells Really Blank (Zen Koan) Ralph Excel Worksheet Functions 2 April 11th 05 12:07 AM


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

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

About Us

"It's about Microsoft Excel"