![]() |
Create graph if value is greater that zero
Hi....
How can I create a "conditional" graph. Meaning...I have ten things that I track each week and I would like a graph to automatically create itself as long as the value is greater than zero. I understand that I can possibly achieve this using a Macro but I do not have the faintest idea how to start. Any help would be fantastic. Cheers! |
Create graph if value is greater that zero
Hi,
First of all, you can use the Macro Recorder to generate the code producing your chart. Before going through the steps of creating the chart, ToolsMacroRecord new macro... After specifying the macro name a toolbox comes up with the record and stop buttons. Stop after you have created the chart to your liking and have moved it exactly where you want it. Second, the following VBA Event Procedure will run automatically if a change in A1 is detected: Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$A$1" Then If Target.Value = xxxx '.............. End If End If End Sub In the place of the ........... you can paste the code generated by the macro recorder. Change the cell (leave the $$) in the 2nd line of the above code to your desired one. Change the xxxx with the value you want in order for the chart to show. This is a special type of a macro and it must be located in the code module of the sheet you want this to happen. Right click the sheet tab, choose View Code... and then the VBA IDE will come up. You can paste the code in the window and then copy and paste from Module1, which will have been created by the recorder. Good luck! Kostis Vezerides musicgirl wrote: Hi.... How can I create a "conditional" graph. Meaning...I have ten things that I track each week and I would like a graph to automatically create itself as long as the value is greater than zero. I understand that I can possibly achieve this using a Macro but I do not have the faintest idea how to start. Any help would be fantastic. Cheers! |
All times are GMT +1. The time now is 09:32 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com