+ Reply to Thread
Results 1 to 13 of 13

New function recording

  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:
    Please Login or Register  to view this content.
    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:
    Please Login or Register  to view this content.
    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:
    Please Login or Register  to view this content.
    but in the code I got while recording- the same one that gave the error - the code looked like that:
    Please Login or Register  to view this content.
    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.

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: New function recording

    I don't understand what you are doing. It looks like your Function is changing the Chart title, a function should return a vlue, e.g. the title. A Sub or procdure would normally be used to change an object. Your Function looks like it will always return "Function - Chart Title"

    Attach an example workbook
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: New function recording

    Do you really need code?
    http://www.andypope.info/tips/tip001.htm
    Cheers
    Andy
    www.andypope.info

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

    Re: New function recording

    I tryed the link you gave - of course it worked great, the problem in it as a code, I tryed to record it- it didn't work.
    I want to inser it to an exsiting code so it must be in vba.
    any suggestions?

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

    Re: New function recording

    this workbook is a good exmple.In cell I1- yellow,I can change the title- and the chart title will be updated, I need this action as a code,
    meaning the code of : inserting the function
    is it clear?

    thanks
    Attached Files Attached Files

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: New function recording

    So code to create the formula, as in the contents of H1?

    Please Login or Register  to view this content.

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

    Re: New function recording

    when I do that in the title I got blank, it's like the function dosen't recognise
    this code, I wrote:
    Please Login or Register  to view this content.
    F5 is the new title, after running the macro , F4 returens:

    Please Login or Register  to view this content.
    instead of :

    Please Login or Register  to view this content.
    and as I said the title itself becomes blank.

    when I was able to recored this actons in the beging the code was:
    Please Login or Register  to view this content.
    but also it dosen't work, F4 was an uknown value :
    Please Login or Register  to view this content.
    really need your help,

    thanks

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: New function recording

    This sets the contents of F4 to be a formula using the function and text in F5 to update the chart.

    Please Login or Register  to view this content.

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

    Question Re: New function recording

    finally !!! it works great!!!
    another thing,
    The text I'm inserting from cell F5 is pretty long. when I wrote titles in the vba, by the code "& Chr(13) & " I was able to display the title in 2 rows. do you know is there a code or function that can split the title in F5 to 2 rows?
    Hope you can help me,
    thanks

  10. #10
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: New function recording

    you can use CHAR(10) in F5 to force a newline.


    ="My" & CHAR(10) & "Title"

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

    Re: New function recording

    where exactly in the code should I insert it?
    what to write instead of the "title"- the text itself or F5?
    thanks!

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,482

    Re: New function recording

    It is not a change to the code or to the cell formula. It is a change to the contents of the cell with the title text in it.

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

    Re: New function recording

    works great!
    thanks again...

+ Reply to Thread

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