Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 25
Default Remove Data from Empty Cells

Hi all,
How do i remove data from the cells that have been pasted as value? The
cells were originally formulas but i have copy-special-value pasted. some of
them are blank but when i do COUNT it counts. how do i remove or clear-all
hundreds of cells at once? there are also cells with the info among them.
Please help. Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Remove Data from Empty Cells

You could try the sub below (by Jay) to clear cells
with residual zero length null strings: "" within a selected range

Just select the range(s), run the sub

Sub ClearNulls()
Set rng = Selection
For Each ar In Selection.Areas
For Each itm In ar
If Trim(itm.Value) = "" _
Then itm.ClearContents
Next 'itm
Next 'ar
End Sub

--
Max
Singapore
http://savefile.com/projects/236895
Downloads:21,000 Files:370 Subscribers:66
xdemechanik
---
"alish" wrote:
How do i remove data from the cells that have been pasted as value? The
cells were originally formulas but i have copy-special-value pasted. some of
them are blank but when i do COUNT it counts. how do i remove or clear-all
hundreds of cells at once? there are also cells with the info among them.


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default Remove Data from Empty Cells


I've run into this several times myself. Odd, huh?

Paste this code into a macro, run it after changing the top range to
aim at your range or column.

Code:
--------------------
Sub ClearNull()
For Each cell In Range("B:B")
If cell.Value = "" Then
cell.ClearContents
End If
Next
End Sub
--------------------


--
JBeaucaire
------------------------------------------------------------------------
JBeaucaire's Profile: http://www.thecodecage.com/forumz/member.php?userid=73
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=45350

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 25
Default Remove Data from Empty Cells

Great!!! It worked. Thank you.

"Max" wrote:

You could try the sub below (by Jay) to clear cells
with residual zero length null strings: "" within a selected range

Just select the range(s), run the sub

Sub ClearNulls()
Set rng = Selection
For Each ar In Selection.Areas
For Each itm In ar
If Trim(itm.Value) = "" _
Then itm.ClearContents
Next 'itm
Next 'ar
End Sub

--
Max
Singapore
http://savefile.com/projects/236895
Downloads:21,000 Files:370 Subscribers:66
xdemechanik
---
"alish" wrote:
How do i remove data from the cells that have been pasted as value? The
cells were originally formulas but i have copy-special-value pasted. some of
them are blank but when i do COUNT it counts. how do i remove or clear-all
hundreds of cells at once? there are also cells with the info among them.


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Remove Data from Empty Cells

Just a note...

I like to use something like this:

Sub ClearNulls()
dim rng as range
dim itm as range
dim ar as range

Set rng = Selection

For Each ar In rng.Areas
For Each itm In ar.cells 'added .cells
If Trim(itm.Value) = "" _
Then itm.ClearContents
Next 'itm
Next 'ar
End Sub

But in this case, you could drop the area portion of the code (since you're
looping through each cell anyway):

Sub ClearNulls()
dim rng as range
dim itm as range

Set rng = Selection

For Each itm In rng.cells
If Trim(itm.Value) = "" Then
itm.ClearContents
end if
Next 'itm

end sub

(I don't like the single line If statement -- especially when they take two
lines <vbg.)

Max wrote:

You could try the sub below (by Jay) to clear cells
with residual zero length null strings: "" within a selected range

Just select the range(s), run the sub

Sub ClearNulls()
Set rng = Selection
For Each ar In Selection.Areas
For Each itm In ar
If Trim(itm.Value) = "" _
Then itm.ClearContents
Next 'itm
Next 'ar
End Sub

--
Max
Singapore
http://savefile.com/projects/236895
Downloads:21,000 Files:370 Subscribers:66
xdemechanik
---
"alish" wrote:
How do i remove data from the cells that have been pasted as value? The
cells were originally formulas but i have copy-special-value pasted. some of
them are blank but when i do COUNT it counts. how do i remove or clear-all
hundreds of cells at once? there are also cells with the info among them.


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Remove Data from Empty Cells

Welcome. Pl acknowledge by pressing the YES buttons (like the one below) in
that response
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:21,000 Files:370 Subscribers:66
xdemechanik
---
"alish" wrote:
Great!!! It worked. Thank you.


  #7   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Remove Data from Empty Cells

Thanks for the thoughts and learnings, Dave !
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:21,000 Files:370 Subscribers:66
xdemechanik
---
"Dave Peterson" wrote in message
...
Just a note...

I like to use something like this:

Sub ClearNulls()
dim rng as range
dim itm as range
dim ar as range

Set rng = Selection

For Each ar In rng.Areas
For Each itm In ar.cells 'added .cells
If Trim(itm.Value) = "" _
Then itm.ClearContents
Next 'itm
Next 'ar
End Sub

But in this case, you could drop the area portion of the code (since
you're
looping through each cell anyway):

Sub ClearNulls()
dim rng as range
dim itm as range

Set rng = Selection

For Each itm In rng.cells
If Trim(itm.Value) = "" Then
itm.ClearContents
end if
Next 'itm

end sub

(I don't like the single line If statement -- especially when they take
two
lines <vbg.)



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
Count Only Empty Cells AFTER Cells with Data David Excel Worksheet Functions 2 September 15th 06 06:05 PM
Remove empty cells from named list / validation list Sp00k Excel Worksheet Functions 4 April 28th 06 03:45 PM
remove error value when formula exists for empty cells Cyrus Excel Worksheet Functions 2 February 17th 06 04:19 PM
How can I remove hidden empty text cells from Excel? Bill Z1P Excel Worksheet Functions 2 October 2nd 05 08:04 PM
data in empty cells samsmimi Excel Worksheet Functions 3 April 1st 05 12:22 AM


All times are GMT +1. The time now is 03:23 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"