Home |
Search |
Today's Posts |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Maintaining cell reference after sorting | Excel Discussion (Misc queries) | |||
how do i set up a single cell continual entry in excel to total f. | Excel Discussion (Misc queries) | |||
Display actual contents of cell | Excel Discussion (Misc queries) | |||
copy a cell value not its function | Excel Discussion (Misc queries) | |||
Transferring cell content between workbooks using cell references | Excel Discussion (Misc queries) |