Macro - Find 1st/last mth values greater than zero, copy to another workbook if difference > than five mths

chlin

Board Regular
Joined
Feb 4, 2009
Messages
54
Hi All,

I need to find the 1st & last mth for which the values is greater than zero. If the 1st mth with values is Jan and last mth is Oct (diff is 9 mths), it should copy to another workbook. If the first mth is Mar and last mth is Aug (diff is 5mths), then it should not copy. For the example below, it should copy Mango, Orange and Pear to Column A of the other workbook. Can anyone help with this? Thanks.

Product </SPAN>
Jan</SPAN>
Feb</SPAN>
Mar</SPAN>
Apr</SPAN>
May</SPAN>
Jun</SPAN>
Jul</SPAN>
Aug</SPAN>
Sep</SPAN>
Oct</SPAN>
Nov</SPAN>
Dec</SPAN>
Mango</SPAN>
50</SPAN>
0</SPAN>
41</SPAN>
0</SPAN>
84</SPAN>
Apple</SPAN>
25</SPAN>
33</SPAN>
23</SPAN>
Orange</SPAN>
75</SPAN>
8</SPAN>
55</SPAN>
Pear</SPAN>
63</SPAN>
6</SPAN>
21</SPAN>
Avocado</SPAN>
52</SPAN>
32</SPAN>

<TBODY>
</TBODY>
 

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.

Forum statistics

Threads
1,215,097
Messages
6,123,079
Members
449,094
Latest member
mystic19

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