+ Reply to Thread
Results 1 to 6 of 6

Worksheetfunction with Asterisk

  1. #1
    Forum Contributor
    Join Date
    05-17-2012
    Location
    CA, USA
    MS-Off Ver
    Microsoft Excel for Microsoft 365
    Posts
    163

    Worksheetfunction with Asterisk

    I'm trying to do either one of the formulas below in VBA using the Application.WorksheetFunction but am having difficulty with the asterisk as part of the worksheet function:

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.
    I think the second formula, once changed over to VB code, might need Application.WorksheetFunction.FormulaArray() as well.

  2. #2
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Worksheetfunction with Asterisk

    I'm not sure what you get by multiplying the column by itself that you don't get with just using Max(A:A). Regarding formula array, on a worksheet the first formula would be an array formula the sum product is fine, it doesn't need to be an array formula.
    In my testing with your formula, both of these work in VBA.


    Please Login or Register  to view this content.
    If you are wanting to put the formula in a cell, then these work:
    Please Login or Register  to view this content.
    Last edited by skywriter; 08-30-2015 at 03:15 AM.
    Click the * Add Reputation button in the lower left hand corner of this post to say thanks.

    Don't forget to mark this thread SOLVED by going to the "Thread Tools" drop down list above your first post and choosing solved.

  3. #3
    Forum Contributor
    Join Date
    05-17-2012
    Location
    CA, USA
    MS-Off Ver
    Microsoft Excel for Microsoft 365
    Posts
    163

    Re: Worksheetfunction with Asterisk

    Hi skywriter,

    The two formulas are to find the last cell in column A that contains text or numeric value but not a formula. Column A may have gaps of rows of blank, some text, some numbers, or a combination of the two. Whichever is the lowest in the column, I'm trying to determine a row count for VB for a particular column.

    In VB, I was using Application.WorksheetFunction. to determine this value and assign it to an integer variable in VB. That's where I had the problem with the asterisk as a multiplier for a worksheetfunction.

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

    Re: Worksheetfunction with Asterisk

    Try using Evaluate.
    If posting code please use code tags, see here.

  5. #5
    Forum Expert skywriter's Avatar
    Join Date
    06-09-2014
    Location
    USA
    MS-Off Ver
    2016
    Posts
    2,760

    Re: Worksheetfunction with Asterisk

    The two that I posted first in sub test are a shortcut for evaluate which is what Norie is suggesting.
    They both seem to work fine. I put some data in some cells and tested them again.

  6. #6
    Forum Contributor
    Join Date
    05-17-2012
    Location
    CA, USA
    MS-Off Ver
    Microsoft Excel for Microsoft 365
    Posts
    163

    Re: Worksheetfunction with Asterisk

    skywriter, I tried using both of those codes separately but referencing a different sheet from the first/main sheet. It came up as an error. Your code works fine with text only but not numeric values if I reference it within the same sheet, so my guess is my referencing is bad when using a remote sheet range? I'd like to reference a remote sheet and check for last row with numeric or text but ignore formula cells. I guess a work around is just using a formula in Excel and reference it from VBA.

    Please Login or Register  to view this content.
    Last edited by T86157; 09-02-2015 at 09:08 PM.

+ 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. Asterisk as WildCard
    By yawnzzzz in forum Excel General
    Replies: 1
    Last Post: 04-14-2010, 09:08 AM
  2. addition with asterisk
    By radkri in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-03-2010, 10:48 PM
  3. SUMPRODUCT contains text, using asterisk
    By commander1 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-09-2009, 04:23 PM
  4. How do I eliminate the asterisk.
    By elcasey125 in forum Excel General
    Replies: 4
    Last Post: 12-03-2008, 11:49 AM
  5. [SOLVED] How do I replace an asterisk without replacing everything?
    By Trw in forum Excel General
    Replies: 4
    Last Post: 06-09-2006, 06:00 PM
  6. [SOLVED] Finding an asterisk
    By Blah in forum Excel General
    Replies: 4
    Last Post: 05-19-2006, 09:45 PM
  7. [SOLVED] asterisk in a cell
    By Caroline41 in forum Excel General
    Replies: 2
    Last Post: 11-30-2005, 01:35 PM
  8. Add asterisk to excel cell
    By jblack35 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-08-2005, 03:06 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