ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Newbie: How to open chart on cell click? (https://www.excelbanter.com/excel-programming/320679-newbie-how-open-chart-cell-click.html)

deko

Newbie: How to open chart on cell click?
 
Is it possible to programmatically create and open a chart when I click on a
cell in a spreadsheet? The value of the cell to be clicked will be
calculated from an array of values in another sheet in the workbook. When I
click the cell, I want to create a chart that shows a graph of the values
that the clicked cell represents. I know how to open the vba editor, but
how do I assign code to a cell? I don't want to use a User Form - I just
want to click a cell in the spreadsheet and create a chart - can this be
done?

Thanks in advance.



K Dales[_2_]

Newbie: How to open chart on cell click?
 
The Worksheet_SelectionChange event occurs whenever the user selects a new
cell (or range), so you can use it to detect the "click" on the cell - for
example, the code below detects a click into cell C5:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

If Target.Address = Range("C5").Address Then

'Create your chart

End If

End Sub

"deko" wrote:

Is it possible to programmatically create and open a chart when I click on a
cell in a spreadsheet? The value of the cell to be clicked will be
calculated from an array of values in another sheet in the workbook. When I
click the cell, I want to create a chart that shows a graph of the values
that the clicked cell represents. I know how to open the vba editor, but
how do I assign code to a cell? I don't want to use a User Form - I just
want to click a cell in the spreadsheet and create a chart - can this be
done?

Thanks in advance.





All times are GMT +1. The time now is 07:38 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com