Apply a macro only to highlighted cells

newwithexcel

New Member
Joined
Jun 19, 2014
Messages
7
I have data in columns that I want to create charts for. However, this data is dynamic and the number of cells where there is data varies. The rest of the cells that don't have numbers have 0s, however if I applied a macro to the whole column all of the zeros would show up in the resulting charts. How can I create a macro where I can highlight just the cells (the ones with non-zero numbers) that I want a chart to be generated for. Thanks for your help! Or is there a way to ignore zeros/blanks completely in the macro?


Example: here are two columns with data. I want to make a macro that creates a chart by just highlighting the actual numbers and ignoring the zeros. Thanks!


Mexico
0.171896
USA
0.132952
Germany
0.113626
Colombia
0.096198
UK
0.085729
France
0

<TBODY>
</TBODY>

Mexico
0.171896
USA
0.132952
Germany
0.113626
Colombia
0
UK
0
France
0

<TBODY>
</TBODY>
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,215,430
Messages
6,124,851
Members
449,194
Latest member
HellScout

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