Results 1 to 12 of 12

Check if all values in Array are greater or less than specific value in worksheet

Threaded View

  1. #1
    Forum Contributor
    Join Date
    12-22-2012
    Location
    Pittsburgh, PA
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    205

    Check if all values in Array are greater or less than specific value in worksheet

    I used the below code to populate an array with values from active cell up 8 rows. I now want to check if all values in the array are either greater than or less than a specific value in worksheet, let's say the check value resides in cell "A1" for simplicity.

    Any help would be greatly appreciated.

    Dim sampleArr() As Variant
    Dim i As Integer
    Dim rng As Range, cel As Range
    
    i = 1
    
    Set rng = Range(ActiveCell, ActiveCell.Offset(-8, 0))
    'Set rng = ActiveCell.Range.Offset(0, 0).Resize(0, -8) ' Note, this creates a 2 Dimensional array
    
    sampleArr = rng ' Right here, this sets the values in the range to this array.
    
    For i = LBound(sampleArr) To UBound(sampleArr)
        Debug.Print sampleArr(i, 1) ' you need the ",1" since this is 2D.
    Next i
    Last edited by jprlimey; 01-25-2017 at 08:45 AM. Reason: Solved

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 3
    Last Post: 10-14-2015, 12:00 PM
  2. [SOLVED] Need to sum up to 50 values until the sum is equal to or greater than a specific value
    By TakiTaki in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-15-2015, 02:01 PM
  3. possible to check for file in multiple folders, then check for values in specific cells?
    By mattheritage in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-04-2014, 08:33 AM
  4. How to display specific cells ranges with values greater than 0 on a separate worksheet
    By studentofthegame in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-13-2012, 04:25 PM
  5. Replies: 0
    Last Post: 10-08-2012, 05:53 PM
  6. Check for values greater than zero in 2 cells
    By spartacus_33 in forum Excel General
    Replies: 4
    Last Post: 11-03-2008, 07:39 PM
  7. How do I search an array for values in a column greater than zero
    By letsagmj in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 07-25-2006, 09:45 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