Results 1 to 13 of 13

New function recording

Threaded View

  1. #1
    Registered User
    Join Date
    08-27-2009
    Location
    Gib
    MS-Off Ver
    Excel 2007
    Posts
    62

    Question New function recording

    Hey,
    I have a function, that one of the members in this forum wrote.
    that changes the title of a chart according to the text that is written in a specific cell.
    I added this code to a module:
    Function A_ChangeChartTitle(CNameD, titleA)
    ActiveSheet.ChartObjects(CNameD).Activate
    With ActiveChart
    .HasTitle = True
    .ChartTitle.Text = titleA
    End With
    A_ChangeChartTitle = "Function - Chart Title"
    End Function
    and I was able to use it in the excel- worked fine.
    I tryed to record it , but only once I succeeded in recording it and I got this code:
      Range("G5").Select
        ActiveCell.FormulaR1C1 = "New Title"
        Range("G3").Select
        ActiveCell.FormulaR1C1 = "=A_ChangeChartTitle()"
        ActiveSheet.ChartObjects("Chart 1").Activate
        ActiveChart.ChartTitle.Select
        Range("G3").Select
        ActiveCell.FormulaR1C1 = "=A_ChangeChartTitle(""Chart 1,G5"")"
    when I tryed to insert it to an existing code I got an error that the value was'nt found.
    Later on I tryed to record it again but it wasn't successfull- there was no code similar to the one I got when I first recorded.

    another thing I noticed is : when I used the function A_ChangeChartTitle stright forward in the excel file:the code in the "insert function" in the excel looked like this:
    =A_ChangeChartTitle("Chart 1",F5)
    but in the code I got while recording- the same one that gave the error - the code looked like that:
    =A_ChangeChartTitle("Chart 1,G5")
    I tryed to change the inverted commas but I got a sintax error.

    Hope you can help me,
    thanks
    Last edited by Abroza; 10-20-2009 at 05:24 AM.

Thread Information

Users Browsing this Thread

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

Tags for this Thread

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