Results 1 to 4 of 4

Offset of Application.Max

Threaded View

  1. #1
    Registered User
    Join Date
    01-26-2011
    Location
    calif
    MS-Off Ver
    Excel 2010
    Posts
    23

    Offset of Application.Max

    I am trying to populate a userform with numbers bigger than ten and smaller than zero.
    I got help with the code below that populates labels 44 to 63 with those numbers (from column "S").
    But I am also trying to populate labels 2 to 21 with an offset of those numbers bigger than ten and smaller than zero from column "B"
    and
    labels 23 to 42 with an offset from column D.


    I have been stuck trying to figure out how to offset Application.Max. The closest thing I got to working was
    MyArray = Range("S4:S" & lrow).Offset(0,-15).Value
    but it only works with numbers.

    Thanks for your help.

    Private Sub UserForm_Activate()
    
    Dim i As Integer
        Dim ws As Worksheet
        Set ws = ActiveSheet
        Dim erange As Range
        Dim lrow As Long
    
    lrow = Range("S" & Rows.Count).End(xlUp).Row
    
    Count = Application.CountIf(Range("S:S"), ">10")
    MyArray = Range("S4:S" & lrow).Value
    
    Entrycount = Application.Min(Count - 1, 19)
    
    For i = 44 + Entrycount To 44 Step -1
    
    M = Application.Max(MyArray)
    P = Application.Match(M, MyArray, 0)
    MyArray(P, 1) = 0
    
    Me.Controls("Label" & i).Caption = M
    
    Next
    
    Count2 = Application.CountIf(Range("S:S"), ">10")
    
    lrow = Range("S" & Rows.Count).End(xlUp).Row
    
    Count = Application.CountIf(Range("S:S"), "<0")
    MyArray = Range("S4:S" & lrow).Value
    
    Entrycount = Application.Min(Count - 1, 19)
    
    For i = (44 + Count2) + Entrycount To (44 + Count2) Step -1
    
    M = Application.Min(MyArray)
    P = Application.Match(M, MyArray, 0)
    MyArray(P, 1) = 0
    
    Me.Controls("Label" & i).Caption = M
    
    Next
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Hiding Application or a Worksheet takes away the ability to use Application properties
    By tfurnivall in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-01-2016, 05:44 PM
  2. [SOLVED] VBA code to change the application.username and application.userinitials
    By jwlamb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 01-10-2014, 11:25 PM
  3. [SOLVED] Obscure VBA error? Application.Run conflicts with Application.GetOpenFileName
    By mc84excel in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 10-15-2013, 08:31 PM
  4. function similar to offset to offset the offset
    By Jerseynjphillypa in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-03-2012, 03:07 PM
  5. [SOLVED] [SOLVED] Application.GetOpenFilename vs Application.Dialogs(xlDialogsOpen)
    By Paul Martin in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-05-2005, 12:05 PM
  6. Replace application.RTD property by Application.RTDServers collect
    By John.Greenan in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-07-2005, 10:05 AM
  7. [SOLVED] error: ActiveCell.Offset(0, -1).Select = Application-defined or object-defined error
    By -[::::Shamran::::]- in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 06-07-2005, 10:05 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