Newbie - IF / THEN and Conditional Formatting Help

Y

Yellowbird

I'd like to search a column for a value (0.00) and change it to
another value (0), which seems simple enough. However, I am running
into some difficulty due to the cell formatting and, being new to
Excel macros, am not quite sure how to "override" the formatting of
certain cells.

The data in the column looks something like:

1.56
0.00
3.10
2.24
9.75
0.00
0.00

I need to change all of the 0.00 values to 0. However, my macro is
already setting the number format for that column to Custom
0.00;-0.00, as follows:

Columns("G:G").Select
Range("G2, G65536").End(xlUp).Offset(1, 0).Activate
Selection.NumberFormat = "0.00;-0.00"

When I try to search the column for the value 0.00, I receive a
message indicating that there are no cells with that value; likewise,
if I highlight the cell, the formula bar at the top of the window
shows the value of the cell as 0, which is actually what I want. I'm
sure this has to do with the cell formatting, so I was thinking I
might be able to create some sort of IF/THEN statement to
conditionally format the cells.

Can anyone suggest a way to first format the column as indicated
above, and then convert any zero values to a single 0?

Thanks in advance,
Yellowbird
 
C

Combo

Macro isn't necessary.

Format all valued cells to custom 0,00;0,0;0

There are 3 parameters separeted by slashdot (;), the first is to positives
values, secound is to negative, and the last is used to zero formatting.


bye


ps: I'm a Brazilian english studant, Sore my grammar errors! :)
 
Y

Yellowbird

Thanks for the reply. Yes, this does work on an individual cell, but I
need to search the column for all instances of 0.00 and replace with
0. When I try to search the column for the value 0.00, I receive a
message indicating that there are no cells with that value; likewise,
if I highlight the cell, the formula bar at the top of the window
shows the value of the cell as 0, which is actually what I want.

Is there a way to skip the empty cells that have my first format:

Columns("G:G").Select
Range("G2, G65536").End(xlUp).Offset(1, 0).Activate
Selection.NumberFormat = "0.00;-0.00"

Do this only for those cells with an actual value and then format the
cells that are empty to custom 0,00;0,0;0 and have them display as 0.
Because I am then outputting this Excel data to a CSV file, I can't
have any blank values in this column - they must be 0.

Thanks for any assistance,
Yellowbird
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top