+ Reply to Thread
Results 1 to 12 of 12

VBA functions

  1. #1
    Registered User
    Join Date
    03-22-2014
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    47

    VBA functions

    Hi,
    I am having problems starting my very first vba function.
    Firstly I saved the uploaded document as a macro enabled workbook and also enabled developer.
    However I am not getting my vba to work.


    Pls download the attachment and do the 2 above steps to assist me.
    Here is the question:
    Cell C2 has the exchange rate for US$ to TT$. In the appropriate code module in this workbook, write a
    VBA procedure with an appropriate name that would be used to calculate the equivalent TT Cost of the
    cars (Cells C4 to C13) when the Cost in US$ and exchange rate are provided as arguments. Use this
    formula for C4, then use the Fill handle, (using the user-created procedure) to copy the formula to the
    range C5:C13.



    This is my created vba:
    Please Login or Register  to view this content.
    and in the excel vehicles, sheet 1, c4:
    =CONVERTTOTT(B4,C2)
    Attached Files Attached Files

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: VBA functions

    Not clear on your question?

    If the selling rate of TT$ is 6.5, then surely the calculation should be US$ x 6.5? In which case, the function should look like:
    Please Login or Register  to view this content.
    Then the formula in C4 (and copied down) is:
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    No idea if this helps, or answers your question (still not clear what you were actually asking...) ?
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,630

    Re: VBA functions

    There's nothing wrong with the function. However, the workbook you have uploaded is not macro enabled and contains no code. That might be the root of your problem.

    Once you have entered the code into the VBE, you need to save the workbook as a macro enabled workbook, .xlsm, or you will lose it.

    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Registered User
    Join Date
    03-22-2014
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    47

    Re: VBA functions

    When I try to save my vba i get the error msg:
    "Be careful! part of your document may include personal information that cannot be removed by the document inspector


    And TMS, I have saved it as a mcro enabled workbook, but I keep getting error msgs when I try to save in VBA OR EXCEL
    Last edited by excel girl; 04-09-2014 at 06:01 PM.

  5. #5
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: VBA functions

    I'm no Math Boffin, but shouldn't it be something like this?

    Please Login or Register  to view this content.
    Regards,
    Rudi

  6. #6
    Registered User
    Join Date
    03-22-2014
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    47

    Re: VBA functions

    Thanks for the math correction Rudis

    still getting the error msg:
    "Be careful! part of your document may include personal information that cannot be removed by the document inspector"
    Last edited by excel girl; 04-09-2014 at 06:21 PM.

  7. #7
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: VBA functions

    Hi,

    Try one of these two actions..

    1.
    Go File, Info, Check for issues, and inspect document.
    Keep everything checked and run it.
    Test to see if the message is resolved.

    If not, try this:

    2.
    Go to File in the upper left hand corner, then Options > Trust Center > Trust Center Settings > Privacy Options
    Then uncheck the check box that says "Remove personal information from file properties on save", then hit OK.
    Test to see if the message is resolved.

  8. #8
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: VBA functions

    Also look at this link, the second reply at the bottom.
    Try that too if the link they refer to is available.

    See: http://stackoverflow.com/questions/2...-that-cannot-b

  9. #9
    Registered User
    Join Date
    03-22-2014
    Location
    USA
    MS-Off Ver
    Excel 2013
    Posts
    47

    Re: VBA functions

    Thank you sooo much! I got it to save.
    Now that I want to run it, I clicked run and I got a box to rename the macro, so do I just have to rename it and try running it again?

    Hey, thanks I got my function to run. :D
    Last edited by excel girl; 04-09-2014 at 06:44 PM.

  10. #10
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA functions

    excel girl,

    Please take a moment to read the forum rules and then amend your thread title to something descriptive of your problem. Once you have done this please send me a PM and I will remove this request.

    To change a Title on your post, click EDIT POST then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

  11. #11
    Valued Forum Contributor
    Join Date
    07-04-2012
    Location
    Cape Town, RSA
    MS-Off Ver
    Office 365 ProPlus
    Posts
    1,050

    Re: VBA functions

    Quote Originally Posted by excel girl View Post
    Thank you sooo much! I got it to save.
    Now that I want to run it, I clicked run and I got a box to rename the macro, so do I just have to rename it and try running it again?

    Hey, thanks I got my function to run. :D
    Hi,

    Just in case you're not sure, you don't actually "run" as function macro. A function macro is either called from VBA (by using its name and passing variables to it) or from Excel where you use it as a function. To access the function you can either type = and then the name of your user defined function (UDF) into a cell or you can click on the FX button in the formula bar and access the library of functions. Your UDF will be located under the User Defined category.

  12. #12
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: VBA functions

    RudiS,

    Your post does not comply with Rule 7 of our Forum RULES. Please do not ignore requests by Administrators, Moderators and senior forum members regarding forum rules.

    If you are unclear about the request or instruction then send a private message to them asking for clarification. Do not post a reply in a thread where a moderator has requested an action that has not yet been complied with e.g Title change or Code tags...etc

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 02-10-2012, 05:27 PM
  2. AddIn With custom functions - Functions not working in Excel2010
    By brum17 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-10-2011, 08:25 AM
  3. Replies: 0
    Last Post: 11-15-2007, 05:24 AM
  4. [SOLVED] efficiency: database functions vs. math functions vs. array formula
    By nickname in forum Excel General
    Replies: 2
    Last Post: 07-13-2006, 11:30 PM
  5. [SOLVED] Conversion from Spreadsheet Toolkit functions (ESSV....) to EssBase API functions
    By sujay in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-05-2006, 05:20 AM

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