+ Reply to Thread
Results 1 to 6 of 6

VBA IndexMatch with For Loop

  1. #1
    Registered User
    Join Date
    05-04-2018
    Location
    Garner, NC
    MS-Off Ver
    MS Office 2016
    Posts
    3

    VBA IndexMatch with For Loop

    'this code only works in the first row and gives error code 1004 application or object define error when it goes around for the 2nd time of the loop.

    [Sub indexmatch()
    Dim x As Long

    For x = 3 To 14
    Cells(x, 8) = Application.WorksheetFunction.Index(Range("b2:f2"), Application.WorksheetFunction.Match(Cells(x, 7), Range(Cells(x, 2), Cells(x, 6))))
    Next x


    End Sub]

    I'm very new to VBA trying to learn it. please explain in detail. Thanks

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,863

    Re: VBA IndexMatch with For Loop

    You don't need to use a formula. Appropriate code will do what you want. Explain in detail what you are trying to do referring to specific cells and attach a copy of your file. This would make it easier to test a possible solution.
    You can say "THANK YOU" for help received by clicking the Star symbol at the bottom left of the helper's post.
    Practice makes perfect. I'm very far from perfect so I'm still practising.

  3. #3
    Registered User
    Join Date
    05-04-2018
    Location
    Garner, NC
    MS-Off Ver
    MS Office 2016
    Posts
    3

    Re: VBA IndexMatch with For Loop

    =INDEX($B$2:$F$2,MATCH($G3,B3:F3,0))
    Above is the actual excel formula that I have on excel spreadsheet that I'm attaching
    I'm trying to loop around the column H to find the lowest bidding vendorindexmatch_screenshot.png

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,863

    Re: VBA IndexMatch with For Loop

    Try:
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-04-2018
    Location
    Garner, NC
    MS-Off Ver
    MS Office 2016
    Posts
    3

    Re: VBA IndexMatch with For Loop

    Thanks! Awesome

  6. #6
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 2013
    Posts
    7,863

    Re: VBA IndexMatch with For Loop

    You are very welcome.

+ 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. [SOLVED] Need Help with an IndexMatch
    By JPW in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-06-2005, 12:05 PM
  2. [SOLVED] Need Help with an IndexMatch
    By JPW in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 09-06-2005, 07:05 AM
  3. [SOLVED] Need Help with an IndexMatch
    By JPW in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 09-06-2005, 06:05 AM
  4. [SOLVED] Need Help with an IndexMatch
    By Jebaneesa in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 03:05 AM
  5. Need Help with an IndexMatch
    By Jebaneesa in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 02:05 AM
  6. [SOLVED] Need Help with an IndexMatch
    By Jebaneesa in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-06-2005, 12:05 AM
  7. Need Help with an IndexMatch
    By Jebaneesa in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 11:05 PM
  8. Need Help with an IndexMatch
    By Jebaneesa in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-05-2005, 10:05 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