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
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 !!!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks