Newbie: How to open chart on cell click?

  • Thread starter Thread starter deko
  • Start date Start date
D

deko

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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top