Create line chart (monthly trends chart) depending on months

RastaBananaa

New Member
Joined
Apr 23, 2018
Messages
8
Hi All,

Hope you could help me with yet another problem.

So I need to create a usage statistics report. As part of the report, I want to create a monthly trends chart. I have figured out a way to do this without any problems. The problem I cannot figure out is how to tell VBA to not create the chart if there is only one month.

So far I have no idea/code of how I am trying to achieve this.

The way I could start it is by doing the following:

Cells.Find(what:="Monthr", after:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Offset(1, 0).Select

The above would find the months column and move to one row down. But then I do not know how to make vba look through all the rows in this column which contain data and see if there is more than one month, skip the chart creation.

All the columns are dynamic and so I cannot have a defined location(as in C6 for example) from which the data can be taken. I do however have two columns, a months column(contains numbers 1-12) and year and month column(contain values jan-18 through to dec-18.... in this exact format)

I hope one of you knowledgeable folks can help.

Thank you in advance!
RastaBananaa
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).

Forum statistics

Threads
1,223,981
Messages
6,175,771
Members
452,668
Latest member
mrider123

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