+ Reply to Thread
Results 1 to 8 of 8

looking for resources on VBA for Excel

  1. #1
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Pendleton, OR
    MS-Off Ver
    Excel 2013
    Posts
    129

    looking for resources on VBA for Excel

    I have been writing some VBA code to do some conversions for GPS data. I could probably find code for what I want to do on the web, but I am curious if anyone knows of a good reference for the basic VBA language. I ask because there are functions in Excel that I cannot seem to get in VBA.

    For example, the Microsoft Excel Help chm file lists Asin as a member of WorkbookFunction object, but I get an error that it is not supported if I use it. I can, however just enter y = asin(x) and I will get the arcsin of x. In this help file, there does not seem to be any reference to functions that are available in VBA - only object members. The one that has me puzzled at the moment is INT(), which is neither a WorkbookFunction member nor an available function in VBA. I can use an If (x<0, RoundDown(x,0), RoundUp(x,0)), but I am more interested right now in finding an accurate list of functions available in VBA.

    My current code is bouncing back and forth between using and not using the WorkbookFunction.trigfunction() and just the trigfunction().

  2. #2
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: looking for resources on VBA for Excel

    You can access (use) most, if not all, Excel's built-in functions in VBA. All you need is to precede the function name with Application() or Worksheetfunction().

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,646

    Re: looking for resources on VBA for Excel

    Workbookfunction?

    Do you mean WorksheetFunction?

    If you do you'll find a full list of the worksheet functions you can use, via WorksheetFunction, in the Object Browser (F2) under WorksheetFunction.

    You can also use the Object Browser to search for VBA functions, for example you'll find the Int function in the Conversion class.
    If posting code please use code tags, see here.

  4. #4
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: looking for resources on VBA for Excel

    In the Object Browser (F2 in the VBE), select VBA from the Library dropdown and below that, enter Math. That will list the native math functions: Abs, Atn, Cos, ...

    There are short routines you can write for the derived trig functions that will be much faster than WorksheetFunction.
    Entia non sunt multiplicanda sine necessitate

  5. #5
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Pendleton, OR
    MS-Off Ver
    Excel 2013
    Posts
    129

    Re: looking for resources on VBA for Excel

    I wrote "WorkbookFunction" in my post, but I was really using WorksheetFunction. Sorry about that error. Been cutting and pasting the phrase in my code and just wrote in wrong in my post. I do get lots of errors when I try this. For example, cos, sin, and tan cannot be preceded with the WorksheetFunction. or I get an error that the function is "not supported." For all of the trig functions, it is one or the other.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: looking for resources on VBA for Excel

    For example, cos, sin, and tan cannot be ...
    Because they are native VBA functions.

  7. #7
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Pendleton, OR
    MS-Off Ver
    Excel 2013
    Posts
    129

    Re: looking for resources on VBA for Excel

    OK..I see that in the Object Browser. Cosh, Cot, and Coth, but no Cos. Which matches my experience with this. Thanks for the point to the Math class. That is very useful to know about. I will be looking there in the future.

  8. #8
    Forum Contributor
    Join Date
    08-16-2012
    Location
    Pendleton, OR
    MS-Off Ver
    Excel 2013
    Posts
    129

    Re: looking for resources on VBA for Excel

    Thanks. That was exactly what I was looking for - a list of the native VBA functions. Didn't have the right search word native to find it.

+ 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. Excel ran out of resources Issue
    By Sekars in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 07-27-2017, 05:17 AM
  2. Replies: 0
    Last Post: 01-21-2014, 07:48 AM
  3. [SOLVED] Excel 2010 resources
    By nygwnj in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-17-2013, 04:47 PM
  4. Com port to excel using to much resources
    By MarlboroMan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 11-12-2011, 05:04 AM
  5. Excel use of system resources
    By klanch in forum Excel General
    Replies: 3
    Last Post: 08-24-2010, 05:22 PM
  6. Excel 2007 : Error - Excel has run out of resources!
    By rikkiholland in forum Excel General
    Replies: 7
    Last Post: 09-22-2009, 04:27 AM
  7. Excel Learning Resources
    By Emt269 in forum Excel General
    Replies: 4
    Last Post: 09-29-2008, 08:14 PM

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