Chart Title Manipulation With Macro Code

Sep 2, 2006

I have a program that updates values quarterly when run. The spreadsheet that it works with also contains a couple of pie charts that correspond to the updated data. the charts only have one series with category values. I recorded a macro to see the code excel uses for creating a new chart and tried to modify the statements to my needs but have been running into runtime error 1004 ("Method ' Cells' of Object '_Global' failed"). The code is as follows I don't have any trouble until the last two statements.

Sub Chart_Updater()
Sheets(Chart1var).Select
With ActiveChart
.HasTitle = True
If Chart1var = "COLI VUL 1 Fund Chart" Then
.ChartTitle.Text = "COLI VUL 1 Allocation by Fund Provider " _
& sday & "-" & sday & "-" & Lyear
ElseIf Chart1var = "COLI VUL 2 Fund Chart" Then
.ChartTitle.Text = "COLI VUL 2 Allocation by Fund Provider " _
& sday & "-" & sday & "-" & Lyear
ElseIf Chart1var = "COLI VUL 7 Fund Chart" Then
.ChartTitle.Text = "COLI VUL 7 Allocation by Fund Provider " _

The variables fundtr1, fundtr2, and emptycolvar are public, and are all returning values, so there is no problem there. Also I can't use ranges like "A1:F7" because the range needs to be variable.

View 5 Replies


ADVERTISEMENT

Name Of Chart As Slide Title?

Jun 2, 2014

In the following macro, how to get the name of the chart as the slide title?

PHP Code: 

Sub Range_Chart_1()
     
     'Requires a reference to the Microsoft PowerPoint Library via the Tools - Reference menu in the VBE
    Dim PPApp As PowerPoint.Application
    Dim PPSlide As PowerPoint.Slide[code]....

View 2 Replies View Related

Concatenate Use On Chart Title

Dec 17, 2007

I'm using concatenate to name a chart title. My problem is that when I concatenate two dates I lose the date format. I'm after a title which looks like 06 December 2007 - 13 December 2007

I'm actually getting 39422 - 39429

The cells have been formatted in date format but lose this when concatenated.

Is there a sollution?

View 9 Replies View Related

VBA Chart Title Difficulties

Oct 12, 2009

I have a pivot table which I update on a regular basis. There's also routine during the pivot table refresh to assign variables to the minimum and maximum dates I include in the range.

Here's what I'm looking for - The chart title needs to be two separate lines. It should look something like this:


Labor Operations performed from min_date to max_date
(labor op code, description, total ops)

By themselves, I have no problem doing this. What I can't figure out is how to format the font of the first line of the title to have different characteristics from the second line. The second line is sort of a descriptor of the part in bold (in an attempt to keep my boss from asking me questions about what he's looking at)

View 9 Replies View Related

Title Chart With File Name`

Jun 10, 2007

Is there a simple way (without writing code) to have a chart title equal the file (workbook) name? For example a formula to write in the 'Chart Options' 'Chart Title' box?

View 7 Replies View Related

Chart Title Depending On Cell Value Using For / To / Next?

Apr 30, 2013

I am creating many graphs. I have already split my data so I can use CurrentRegion.I want each graph to have a different title using the text value of a cell which would be (6 * j - 5, 2) inside the For/To, but I can't get it to work no matter how much I tinker.This is the code as is without any of my attempts inside to clutter it up.

VB:
Dim p As Long p = Sheets("ForWeb").UsedRange.Rows.Count For j = 1 To (p - 1) / 4 ActiveSheet.Shapes.AddChart.Select ActiveChart.ChartType = xlLine ActiveChart.SetSourceData Source:=Cells(6 * j - 5, 5).CurrentRegion ActiveChart.Parent.Cut Cells(6 * j - 5, 1).Select ActiveSheet.Paste Next

View 2 Replies View Related

Adding Dynamic Title To Chart?

Mar 5, 2014

c5 shows today() and I'd like c5.value to be the headline of a chart. Hence, in sample file the headline be changed to 05/03/2014 (and tomorrow to 06/03/2014..).

View 2 Replies View Related

Change Title In Legend On Chart?

Jul 31, 2014

How do i change a title in legend on a chart. i.e. I want the label to be MGRS 2%

Job Category
Category %
EE Total

Mgrs
2%
15

Supvr
6%
51

[code]....

View 2 Replies View Related

Formula Entry Into Chart Title

Feb 12, 2007

I've found several threads describing how to make a chart title dynamic by entering a cell reference into the formula bar with the chart title selected. I am wondering if anyone knows if it is possible to have VBA "code" a formula into a chart title that would be a concatenation of several strings. Ideally, I'd like to specify part of the title from a variable, and another part from a user-specified range, as in the following snippet from a module of mine:

ChartSubtitleText = Sheets("Sheet1").Range("A5")
ActiveChart.ChartTitle.Select
Selection.Characters.Text = ChartTitleText & Chr(10) & ChartSubtitleText

where ChartTitleText is a string variable that is passed to the Sub. This works fine and correctly builds the title block during execution of the macro, but I'd like to modify the capability to allow the user to enter a new value in Sheet1!A5 and have all of the charts update dynamically without re-executing the macro. Is there a way to have VBA create the chart and build the Chart Title with a formula that will allow for dynamic updating? I've tried having it enter the following line into the formula bar, but get errors: =CONCATENATE(ChartTitleText, CHAR(10), Sheet1!A5)

View 5 Replies View Related

Cell As Chart Title When Using More Than 1 Column Of Data?

Apr 30, 2014

I have a very simple template which plots out means and standard errors of a treatment structure. The input is from an analysis of variance so I want to have the significance levels dispalayed in the title. This is simple for a single col of data but when there are more then one it doesn't use a cell to populate the chart title.

From the sheet I've attched the first and second chart have dynamic titles, if you change cell F10 from 0.364 to 0.001 the title on the second chart will change to "Input (**)" as it uses M19 for the title. The problem is that for the 3rd chart titled "CV*TR (NS)" any change has to be done manually (change cell F15 to 0.04 and this changes cell J43 to "CV*TR (*)".

example.xlsx

View 1 Replies View Related

Excel 2010 :: For Mac - Putting Title On A Chart

Jul 31, 2012

How do I put a title on my chart, I'm using 2010 excel for mac.

View 2 Replies View Related

Updating Multiple Chart Options (e.g. Title)

Apr 2, 2007

Is it possible to update Chart Titles in Batches. For the following Titles:

'Client 1, Jan 07'
'Client 2, Jan 07'
'Client 3, Jan 07'
'Client 4, Jan 07',

Would you be able to change 'Jan 07' to Jan 08' on all of the above whilst keeping the variable client name, in a single batch process?

View 3 Replies View Related

Prevent Chart Title And Plot Area Overlapping

Jan 29, 2010

how to resize the plotarea of a chart so that it wont overlap with the title. I can't seem to find the appropriate property to let me determine the height or the bottom edge of the chart title.

View 2 Replies View Related

Automatic Chart Title Update From Filtered Criteria

May 2, 2008

I am having difficulty figuring out how to get my chart title to automatically update when my chart changes via filtered criteria. I can get it to change by clicking the title bar on the chart, but would like the title to automatically update as soon as I select new criteria and the chart changes.

View 9 Replies View Related

Excel 2010 :: Linking Cell Text To Chart Title

Dec 21, 2013

Why the heck every time I enter in to the "edit text" area of the chart title box in a chart in Excel 2010 and type "=B27" (without the quotation marks, and understanding the contents of "B27" has the text I wish to display) does this idiot thing simply display "=B27" (again, without the quotation marks)???

View 4 Replies View Related

Excel 2010 :: Making Chart Title From Cell Contents?

Jan 10, 2014

I am trying to make the contents of a cell into a chart title.I know I can do it like this...

ActiveChart.ChartTitle.Select
Selection.Caption = "=tab_name!R2C1"

However, I am trying to use the same macro on several different tabs in the same EXCEL worksheet. Obviously, I can't have the tab name in the macro. But, I don't get a title at all when I try to remove it like this...

ActiveChart.ChartTitle.Select
Selection.Caption = "=R2C1"
or
ActiveChart.ChartTitle.Select
Selection.Caption = "=A2"

Is this possible? I am (kinda new at) using EXCEL2010.

View 3 Replies View Related

Date Based Bar Chart Macro Code

Mar 21, 2008

I am working on a manning document which tells me when people report, and depart based on their job position. I have all of the info in one worksheet, and want to generate a bar like graph on another worksheet in the workbook (by just changing the cell color for ease) for a snapshot to view holes in job positions.

The snapshot worksheet has the list of jobs on the left, and months/years in a line acorss the top i.e.

2006
| J | F | M | A | M | J | J | A | S | O | N | D |
Job Position X X X X X X
Job Position X X X X X X

Here was the code I started with, and it doesn't do anything!

Private Sub Workbook_CreateCalendar(ByVal Sh As Object, ByVal Target As Range)

Dim Firstrow As Long
Dim Lastrow As Long
Dim Lrow As Long
Dim Fcol As Date
Dim Lcol As Date
Dim Lencol As Long
Dim CalcMode As Long
Dim ViewMode As Long
'Set the Start Date of your Sheet
Dim DatTim1 As Date
DatTim1 = #1/1/2006#

View 5 Replies View Related

Delete Chart Series Via Macro Code

May 27, 2008

I have a spreadsheet (see attached) in which there are many series and i want to be able to delete most of the series except the first 4.

(The 0%, 5% 10% air voids and the 95% comp line)

iv got this code, which is attacted to a command button, which works fine to delete all the series but makes the graph a blank white box. id prefer it so it delete just the series not the graph "picture?" ...

View 7 Replies View Related

Macro Code To Add More Rows To Existing Chart

Jun 17, 2008

I have managed to create something similar to what i am working for using an example from Lacher and Gant Charts. i am now stuck as I can enter more than 40 status as it then gives me an error. The following is the code: Can any1 highlight where i need to make any changes to stop the error from occuring:

Option Explicit
Sub CreateTimeChartData()
Dim vTimeData As Variant
Dim i As Integer
Dim sRoom As String
Dim vLastEndTime As Variant
Dim oSeries As Series
' set up
Application. ScreenUpdating = False
Application.DisplayAlerts = False
' create chart data worksheet
With Worksheets("TimeData"). Range("TimeList"). CurrentRegion
.Sort Key1:="Room", Key2:="Start Time", Header:=xlYes
vTimeData = .Value
Worksheets.Add
On Error Resume Next
Worksheets("ChartData").Delete..........................

View 3 Replies View Related

Title Of A Document Contains A Period And Is Stopping The Code

Jun 14, 2007

I have a two documents whose names contain periods out of 70. Example is St._Paul and St._Louis_Park. When I run through the code it stops it with the error that the name cannot be found. My list looks like this..

Club Name
Eagan
Apple_Valley
St._Paul
etc.

When I remove the period it works. Is there a way to make it work with the period in there so I don't have to change a bunch of files and documents? Here is the code...

Sub OpenUp()
Dim wb As Workbook
Dim ws As Worksheet
Set wb = Workbooks(ThisWorkbook.Name)
Set ws = wb.Worksheets(1)
With ws
TotalRow = .Cells(1, 255).End(xlDown).Row
Finalrow = .Cells(TotalRow, 1).End(xlUp).Row
End With
For i = 2 To Finalrow
clb = ws.Cells(i, 2)
psw = ws.Cells(i, 3)
psw2 = ws.Cells(i, 4)
mnth = ws.Cells(i, 5).........................

View 5 Replies View Related

Add Secondary Chart X-axis Below Primary Via Macro Code

Apr 27, 2008

In VBA, how to add a secondary x-axis in the lower portion of the chart if I already have the primary axis in the upper part?

This code

ActiveChart.HasAxis(xlCategory, xlSecondary) = True

just adds it to the upper if I have the primary at lower.

View 4 Replies View Related

Macro Code To Count Number Of Chart Series

Jul 1, 2008

I have about 50 lincharts that I wont to update with VBA but they have different number of series. Some have two series, some three and others four. Is there a way to count how many series a chart has? Otherwise could I get tips on how to approach this problem.

View 2 Replies View Related

Change Order For Chart Series Collection Macro Code

Mar 18, 2008

I have a bar graph with 2 series of data. Anyone knows how I can specify the order in which they appear? code looks similar to the following. The bar graph shows the second series before the first series. How do I reverse the order?

With cht
.ChartType = xlColumnClustered

' first data series
Set ser = .SeriesCollection.NewSeries
With ser
.Values = someValues
.XValues = someValues
End With

' second data series
Set ser = .SeriesCollection.NewSeries
With ser
.Values = someValues
.XValues = someValues
End With

View 2 Replies View Related

Create Surface Chart Via Macro Code Based On Selection

May 28, 2008

I want to write a macro to add a surface chart for a Data Range which includes 6000 data points. But the series selected for the chart don't cover all Data Ranges, only part of them.

Public Sub AddChart2(LastRow As Integer, LastCol As Integer)

Dim cht As ChartObject, currentSheet As Worksheet
Dim rng As Range, newRow As Range, srcRange As Range
Dim colIdx As Integer

colIdx = 5

View 7 Replies View Related

Adding Title Lines Within A Macro

Jul 20, 2007

i am completely new to writing macros. have recorded a macro but have just found out the each of the new sheets that the macro creates needs a line at the top of the sheet with a title in it

View 2 Replies View Related

Change Page Title With Macro When Saving As MHT?

Mar 22, 2013

I want to use a macro to save an .xls file as an .mht file. I have:

ActiveWorkbook.SaveAs Filename:="C:ReportsBook2.mht", FileFormat:= _
xlWebArchive, CreateBackup:=False

which works for saving, but how can I Change the resulting web Page Title using VBA? I tried recording the macro as I changed the title and saved but nothing recorded for that. I know I can always just go in after the macro runs and manually change it but it seems like there must be another way.

View 2 Replies View Related

Macro To Count # Of Data Rows (excl Title & Auto-sum Row @ Btm) And Put Result In L2.

Feb 20, 2009

Is there a way to count the total number of rows with data (excluding title row at top and Auto-Sum row at bottom) and put the result in L2?

View 14 Replies View Related

Chart Hyperlinks: Attach A Macro So That When The Chart Is Clicked It Returns To Sheet - Home

Feb 24, 2007

I know this has been discussed a number of times, but here is my problem
I have three charts in my workbook. I want to attach a macro so that when the chart is clicked it returns to Sheet - Home. I have using the following:
worksheets("Home").activate. But after I protect each chart and the workbook, and save and exit. When I reload the Workbook it has forgotten the assigned macros and nothing happens.

View 7 Replies View Related

VBA String Manipulation

Sep 1, 2009

I need to be able to take someones name which is in a single cell in the format "First Middle Last" (could be more than one middle name) and then split it up so that it fits the following format:

Last name (must be 50 characters)
Middle name (must be 15 characters)
First Name (must be 15 characters)

I'm unsure on the right combination of operators to use to variably concatenate strings in this way. I'm confident I can figure out how to add the white spaces after a name to make it fit the character requirement but I don't know how to split the initial name up into it's 3 parts. Names longer than the character requirement will just be truncated.

View 9 Replies View Related

Text Manipulation

Dec 30, 2009

Column A

Column B
Column C

Economy
BRITZEconomy
Question

Compact
BRITZCompact
What formula do I need to use in column A to get the desired results as per Column C?

Medium
BRITZMedium

Large
BRITZLarge

Bus
BRITZBus

Bikes
BRITZBikes

4X4
BRITZ4X4

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved