Results 1 to 4 of 4

Thread: Opening a window clicking on a bar in a bar chart

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    2

    Opening a window clicking on a bar in a bar chart

    Hello,
    I am working with an Excel sheet.
    I need to open a window displaying something whenever i click on a bar in a bar chart.

    Is this possible?

  2. #2
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Opening a window clicking on a bar in a bar chart

    ok.. this took a bit of work to figure out... but I got it

    add this code to the sheet that contains the chart
    switch to another sheet.... then back to the sheet
    now click one of the bars..
    VB Code:
    1. Dim WithEvents cht As Chart
    2.  
    3. Private Sub cht_Select(ByVal ElementID As Long, ByVal Arg1 As Long, ByVal Arg2 As Long)
    4.     Select Case Arg1
    5.         Case 1
    6.             MsgBox "Picked series 1"
    7.         Case 2
    8.             MsgBox "Picked series 2"
    9.         Case Else
    10.             MsgBox "Picked series " & Arg1
    11.     End Select
    12.            
    13. End Sub
    14.  
    15.  
    16. Private Sub Worksheet_Activate()
    17.     Set cht = ChartObjects(1).Chart
    18. End Sub
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2006
    Posts
    2

    Re: Opening a window clicking on a bar in a bar chart

    thanks for your code, has worked very well!

  4. #4
    PowerPoster Static's Avatar
    Join Date
    Oct 2000
    Location
    Rochester, NY
    Posts
    9,390

    Re: Opening a window clicking on a bar in a bar chart

    Gald to hear it!!

    oh.. and
    JPnyc rocks!! (Just ask him!)
    If u have your answer please go to the thread tools and click "Mark Thread Resolved"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width