select any chart in worksheet

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Try...

Code:
ActiveSheet.ChartObjects("Chart 1").Select

However, it's usually not necessary to select an object before setting its properties/methods.
 
Upvote 0
sorry you don't understand what i meant
i want form can select any chart from my worksheet to modify on it
 
Upvote 0
Unfortunately, I still don't understand. Can you please elaborate?
 
Upvote 0
sorry another time ...... :)
in excel i have more than chart already i want modify on one of them
so i need to make form if i but name of chart automatically selected


by example ...... if i but in InputBox ("test")
the code fill with >
ActiveSheet.ChartObjects("test").Select
 
Upvote 0
Do you mean ...

Code:
ActiveSheet.ChartObjects(InputBox("Chart name?")).Select
 
Upvote 0
very brilliant thank you :)
now if i want change the title of chart i selected


for example


.HasTitle = True
.ChartTitle.Text = Application.InputBox("")

whit your code
 
Upvote 0
Or, with error checking, maybe...

Code:
[FONT=Courier New][COLOR=darkblue]Option[/COLOR] [COLOR=darkblue]Explicit[/COLOR]

[COLOR=darkblue]Sub[/COLOR] test()
    
    [COLOR=darkblue]Dim[/COLOR] ChrtObj [COLOR=darkblue]As[/COLOR] ChartObject
    [COLOR=darkblue]Dim[/COLOR] ChartName [COLOR=darkblue]As[/COLOR] [COLOR=darkblue]String[/COLOR]
    
    ChartName = Application.InputBox( _
        Prompt:="Please enter a chart name...", _
        Title:="Chart Name")
        
    [COLOR=darkblue]If[/COLOR] ChartName = "False" [COLOR=darkblue]Then[/COLOR] [COLOR=darkblue]Exit[/COLOR] [COLOR=darkblue]Sub[/COLOR]
    
    [COLOR=darkblue]On[/COLOR] [COLOR=darkblue]Error[/COLOR] [COLOR=darkblue]Resume[/COLOR] [COLOR=darkblue]Next[/COLOR]
    [COLOR=darkblue]Set[/COLOR] ChrtObj = ActiveSheet.ChartObjects(ChartName)
    [COLOR=darkblue]On[/COLOR] [COLOR=darkblue]Error[/COLOR] [COLOR=darkblue]GoTo[/COLOR] 0
    
    [COLOR=darkblue]If[/COLOR] [COLOR=darkblue]Not[/COLOR] ChrtObj [COLOR=darkblue]Is[/COLOR] [COLOR=darkblue]Nothing[/COLOR] [COLOR=darkblue]Then[/COLOR]
        ChrtObj.Select
    [COLOR=darkblue]Else[/COLOR]
        MsgBox "A chart named '" & ChartName & "' does not exist, please try again!", vbExclamation
    [COLOR=darkblue]End[/COLOR] [COLOR=darkblue]If[/COLOR]
    
[COLOR=darkblue]End[/COLOR] [COLOR=darkblue]Sub[/COLOR]
[/FONT]
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,263
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top