Closed Thread
Results 1 to 2 of 2

Chart displayed is via drop down menu

Hybrid View

Buster1320 Chart displayed is via drop... 05-14-2008, 02:48 AM
VBA Noob Buster1320, Duplicate post... 05-14-2008, 03:04 AM
  1. #1
    Registered User
    Join Date
    05-14-2008
    Posts
    7

    Chart displayed is via drop down menu

    I have a workbook with several sheets of data and charts... I want to be able to hide all of the data and individual charts so that when someone opens the workbook they only see a single sheet. I want the individual that opens the workbook to select from a dropdown menu and *poof* that chart is displated on the "front page".... I am pretty proficient with Excel, but not with VBA or the use of Macros. I found the below code, which appears todo want I want.... But it doesn't work. Is there something that I need todo in order for the code to "run"? I need to be able to send these files to others and have it work without them doing anything "special"....

    The code I found...

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim chartToCopy As ChartObject
    'launch macro when InCell dropdown in E3 changes
    If Target.Address = Range("e3").Address Then
    'delete existing chart
    If Me.ChartObjects.Count > 0 Then
    Me.ChartObjects(1).Delete
    End If
    If Target = "Branch1" Then
    Set chartToCopy = Sheets("Sheet1").ChartObjects(1)
    ElseIf Target = "Branch2" Then
    Set chartToCopy = Sheets("Sheet2").ChartObjects(1)
    Else
    End
    End If
    chartToCopy.Copy
    Me.Paste Range("c5")
    Application.CutCopyMode = False
    End If
    End Sub


    Thanks!
    Buster

  2. #2
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Buster1320,

    Duplicate post and code unwrapped. Thread closed.

    Please take 5 mins to read our forum rules below and then wrap the code in your other post

    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1