Delete Zero's

Jenawade

Board Regular
Joined
Apr 8, 2002
Messages
231
After I run a macro that changes the line number in a whole bunch of formula's, pastes values and does a save as, I'm left with some zero's in the cells that didn't pull in data. Is there a way to remove just those zero's, but not zero's that are a part of a text/number string, a number, or one of the formula's left in the sheet? For example (below), I don't want to delete any existing zero's in an actual cost in col N, or in a part # in col K, or the # in col G. Is there something I can add to my macro to remove just the zero's if the cell contains nothing other than a single zero?


Excel Workbook
CDEFGHIJKLMN
490001500.00%Alligator1211168-26SNut1$0.00000
5000010.67540.00%01211168-23SL501$1.41000
51000100.00%0.21920.00%00211168-18SCap1$0.45750
52000100.00%0.10540.00%00211168-19SScrew1$0.22000
53000100.00%00.00%00000$0.00000
54000100.00%00.00%00000$0.00000
55000100.00%00.00%00000$0.00000
56000100.00%00.00%00000$0.00000
57000100.00%00.00%00000$0.00000
58000100.00%00.00%00000$0.00000
PLQ Form
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
use find Control+F and then in click options menu find 0, use replace all
 
Upvote 0
I think the usual method of achieving this is to use conditional formatting to set the foreground colour of any cells whose value is equal to zero to be the same as the background colour.

If you absolutely must get rid of those poor, harmless little zeroes, as the final step in your macro you could whizz through all the cells in the used portion of the worksheet and clear them. Something like this:-
Code:
dim ocell as range
for each ocell in activesheet.usedrange
    if ocell.value=0 then ocell.clearcontents
next ocell
You might need to change activesheet to whatever sheet you're actually operating on.
 
Upvote 0
Hehe, those poor little buggers are just misunderstood. I just found (and tested) this before I read your reply.

Code:
.Rows("4:59").Replace What:="0", Replacement:="", LookAt:=xlWhole

Thanks!
 
Upvote 0

Forum statistics

Threads
1,224,521
Messages
6,179,286
Members
452,902
Latest member
Knuddeluff

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top