Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
One-Leg
 
Posts: n/a
Default If cell = "0", then clear the cell

Hello,

I would like to use a macro that will allow me to select the range A2 to
A65536 and every cells with a value that equals "0" must be cleared.

I don't wanna use the Find/Replace feature cause it removes the "0" from the
other cells and I really need them to remain intact. Here is an idea of what
I have:


A2: 4852035
A3: 8563201
A4: 4845625
A5: 4842562
....
A325: 4521023
A326: 4120001
A327: 7841036
A328: 0
A329: 0
A330: 0
....
A65534: 0
A65535: 0
A65536: 0


The cells having only a "0" in them will change all the time. One minute
it's from A328 to A65536 and the next, it's from A378 to A65536 (my file
updates itself from an SWL database.

I used the following form in my macro but my "0" stayed the

Range("A2:A65536").Select
If Cells.Select = 0 Then Selection.ClearContents

Any help would be great!!!
  #2   Report Post  
Dave R.
 
Posts: n/a
Default

You are looking for VBA, but can't you just check the box for "match entire
cell contents" when doing a find and replace (it's under the options button
after pressing CTRL-H)?


"One-Leg" wrote in message
...
Hello,

I would like to use a macro that will allow me to select the range A2 to
A65536 and every cells with a value that equals "0" must be cleared.

I don't wanna use the Find/Replace feature cause it removes the "0" from

the
other cells and I really need them to remain intact. Here is an idea of

what
I have:


A2: 4852035
A3: 8563201
A4: 4845625
A5: 4842562
...
A325: 4521023
A326: 4120001
A327: 7841036
A328: 0
A329: 0
A330: 0
...
A65534: 0
A65535: 0
A65536: 0


The cells having only a "0" in them will change all the time. One minute
it's from A328 to A65536 and the next, it's from A378 to A65536 (my file
updates itself from an SWL database.

I used the following form in my macro but my "0" stayed the

Range("A2:A65536").Select
If Cells.Select = 0 Then Selection.ClearContents

Any help would be great!!!



  #3   Report Post  
One-Leg
 
Posts: n/a
Default

THANK YOU!!! It worked...

"Dave R." wrote:

You are looking for VBA, but can't you just check the box for "match entire
cell contents" when doing a find and replace (it's under the options button
after pressing CTRL-H)?


"One-Leg" wrote in message
...
Hello,

I would like to use a macro that will allow me to select the range A2 to
A65536 and every cells with a value that equals "0" must be cleared.

I don't wanna use the Find/Replace feature cause it removes the "0" from

the
other cells and I really need them to remain intact. Here is an idea of

what
I have:


A2: 4852035
A3: 8563201
A4: 4845625
A5: 4842562
...
A325: 4521023
A326: 4120001
A327: 7841036
A328: 0
A329: 0
A330: 0
...
A65534: 0
A65535: 0
A65536: 0


The cells having only a "0" in them will change all the time. One minute
it's from A328 to A65536 and the next, it's from A378 to A65536 (my file
updates itself from an SWL database.

I used the following form in my macro but my "0" stayed the

Range("A2:A65536").Select
If Cells.Select = 0 Then Selection.ClearContents

Any help would be great!!!




  #4   Report Post  
Dave R.
 
Posts: n/a
Default

No problem. Here is a VBA solution as well, you'll have to select cells
first.

Sub fook()
Dim cell As Range
For Each cell In Selection
If cell.Value = 0 Then
cell.Clear
End If
Next
End Sub



"One-Leg" wrote in message
...
THANK YOU!!! It worked...

"Dave R." wrote:

You are looking for VBA, but can't you just check the box for "match

entire
cell contents" when doing a find and replace (it's under the options

button
after pressing CTRL-H)?


"One-Leg" wrote in message
...
Hello,

I would like to use a macro that will allow me to select the range A2

to
A65536 and every cells with a value that equals "0" must be cleared.

I don't wanna use the Find/Replace feature cause it removes the "0"

from
the
other cells and I really need them to remain intact. Here is an idea

of
what
I have:


A2: 4852035
A3: 8563201
A4: 4845625
A5: 4842562
...
A325: 4521023
A326: 4120001
A327: 7841036
A328: 0
A329: 0
A330: 0
...
A65534: 0
A65535: 0
A65536: 0


The cells having only a "0" in them will change all the time. One

minute
it's from A328 to A65536 and the next, it's from A378 to A65536 (my

file
updates itself from an SWL database.

I used the following form in my macro but my "0" stayed the

Range("A2:A65536").Select
If Cells.Select = 0 Then Selection.ClearContents

Any help would be great!!!






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
Maintaining cell reference after sorting GRITS Excel Discussion (Misc queries) 2 April 30th 23 07:42 PM
how do i set up a single cell continual entry in excel to total f. mike@swallow Excel Discussion (Misc queries) 1 December 7th 04 12:29 PM
Display actual contents of cell xmasbob Excel Discussion (Misc queries) 1 December 6th 04 05:09 PM
copy a cell value not its function KC Mao Excel Discussion (Misc queries) 2 December 4th 04 04:30 AM
Transferring cell content between workbooks using cell references Kiwi Mike Excel Discussion (Misc queries) 2 November 27th 04 11:31 PM


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