Consulting

Results 1 to 3 of 3

Thread: Find Small in and Array

  1. #1

    Find Small in and Array

    I'm trying to find the first Small number in a one dimensional array as shown below. I'm trying to use SortArray() to define that range. Is this not possible? If so, how can I sort an array. Thanks.

    L = WorksheetFunction.Small(SortArray(1), SortArray(4), 1)
    Last edited by Aussiebear; 04-16-2023 at 04:10 PM. Reason: Added code tags

  2. #2
    VBAX Guru mancubus's Avatar
    Joined
    Dec 2010
    Location
    "Where I lay my head is home" :D
    Posts
    2,644
    this may give you an idea:
    PHP Code:
    MsgBox Application.Small(Array(1104556079), 5
    the result is 10, which is the 5th smallest number in the array.
    PLS DO NOT PM; OPEN A THREAD INSTEAD!!!

    1) Posting Code
    [CODE]PasteYourCodeHere[/CODE]
    (or paste your code, select it, click # button)

    2) Uploading File(s)
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) (multiple files can be selected while holding Ctrl key) / Upload Files / Done
    Replace company specific / sensitive / confidential data. Include so many rows and sheets etc in the uploaded workbook to enable the helpers visualize the data and table structure. Helpers do not need the entire workbook.

    3) Testing the Codes
    always back up your files before testing the codes.

    4) Marking the Thread as Solved
    from Thread Tools (on the top right corner, above the first message)

  3. #3
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Not at all sure what you're trying to do but you might get more joy using Application rather then WorksheetFunction, especially if you're using an array as the 2nd argument of the Small function:
    2023-04-05_114234.jpg
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •