+ Reply to Thread
Results 1 to 1 of 1

max+if+array

  1. #1
    Registered User
    Join Date
    12-12-2012
    Location
    syria
    MS-Off Ver
    Excel 2010
    Posts
    13

    max+if+array

    hello,
    I'm a new member, and I'm a beginner in vba excel macro....
    I need to use excel macro to write this as vba array code:
    =MAX(IF(C:C=B3,D:D,0))
    I did it by pressing Ctrl+Shift+Enter

    1.jpg
    I need to set it to a one element array s(0,0) with one number and set it to one cells(3,7) as an array cell, then I have to Put it into loop in cells (i,7) ,and if possible I want to put all results in one array named s and then set it into "J:J" on my workesheet
    I tried this code:

    Private Sub Worksheet_Activate()
    Dim s(0, 0) As Single
    For i = 3 To 355
    s = "=MAX(IF(C:C=cells(i,2);D:D;0))"
    Cells(i, 7) = s
    Next i
    End Sub

    yet, thier are some mistakes in my code because I don't Know How to deal with arrays in vba code and the code won't work without array form ........ I tryed alot to search the solve and tried " .formulaarray " but no results...
    Attached Images Attached Images

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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