ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Clearing a chart title with less lines of code (https://www.excelbanter.com/excel-programming/298609-clearing-chart-title-less-lines-code.html)

Don Wiss

Clearing a chart title with less lines of code
 
Right now to clear a chart title I'm running the below code. I would think
that I could clear it in a single line without having to activate the chart
object. But I haven't figured out how.

Dim SheetName As String, Here As String
SheetName = ActiveSheet.name
Here = ActiveCell.Address

Sheets("Graphs").Select
ActiveSheet.ChartObjects(1).Activate
ActiveChart.ChartArea.Select
ActiveChart.HasTitle = False

Range("A1").Select

Sheets(SheetName).Select
Range(Here).Select

Don <donwiss at panix.com.

Rob Bovey

Clearing a chart title with less lines of code
 
Hi Don,

Sheets("Graphs").ChartObjects(1).Chart.HasTitle = False

--
Rob Bovey, MCSE, MCSD, Excel MVP
Application Professionals
http://www.appspro.com/

* Please post all replies to this newsgroup *
* I delete all unsolicited e-mail responses *


"Don Wiss" wrote in message
...
Right now to clear a chart title I'm running the below code. I would think
that I could clear it in a single line without having to activate the

chart
object. But I haven't figured out how.

Dim SheetName As String, Here As String
SheetName = ActiveSheet.name
Here = ActiveCell.Address

Sheets("Graphs").Select
ActiveSheet.ChartObjects(1).Activate
ActiveChart.ChartArea.Select
ActiveChart.HasTitle = False

Range("A1").Select

Sheets(SheetName).Select
Range(Here).Select

Don <donwiss at panix.com.





All times are GMT +1. The time now is 05:36 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com