+ Reply to Thread
Results 1 to 4 of 4

Applying Excel functions to arrays

  1. #1
    Forum Contributor
    Join Date
    08-25-2014
    Location
    Pennsylvania, US
    MS-Off Ver
    Windows '16
    Posts
    165

    Applying Excel functions to arrays

    Hi everyone. I'm beginning to learn VBA and have a general question about it that I could not find the answer to through searching. How can I apply regular Excel functions to items in an array? Obviously this varies by the type, complexity, and arguments required for each function, but for example: If I have string array NeedsTrimmed and want to apply the TRIM() function to each item in the array, what's the syntax look like?

    Thanks.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,598

    Re: Applying Excel functions to arrays

    Access the elements of the array with a vartype Long and loop through the array:
    Please Login or Register  to view this content.
    Ben Van Johnson

  3. #3
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,516

    Re: Applying Excel functions to arrays

    Try
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    08-25-2014
    Location
    Pennsylvania, US
    MS-Off Ver
    Windows '16
    Posts
    165

    Re: Applying Excel functions to arrays

    Great, both of those answer my question. Thanks!

+ 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. Arrays and Functions
    By NatalieEC in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-04-2014, 03:55 PM
  2. VBA Arrays-A few useful functions
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 07-28-2013, 08:09 PM
  3. Applying a specific functions over a range of cells
    By Rikolos in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-27-2010, 07:35 PM
  4. Replies: 1
    Last Post: 06-09-2010, 09:26 AM
  5. Functions and arrays
    By Pluppen in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 05-28-2008, 08:38 AM
  6. [SOLVED] Excel functions which support arrays (SHIFT-CNTRL-ENTER)?
    By ExcelMonkey in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-19-2006, 01:45 PM
  7. [SOLVED] Using Excel Worksheet functions in Arrays
    By The Roon in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-13-2005, 02:06 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