+ Reply to Thread
Results 1 to 2 of 2

Knapsack Problem looping through Range

  1. #1
    Registered User
    Join Date
    07-27-2011
    Location
    hamburg, germany
    MS-Off Ver
    Excel 2003
    Posts
    1

    Question Knapsack Problem looping through Range

    Hi all,

    that`s my first post in this forum and its a little bit tricky. I hope u can help me out with this one
    First off all I got a VBA Code to match a particular Sum with multiple summands from a given list of numbers. From the code so far I am able to type in a Sum and get the matches displayed.
    Unfortunately I need to loop through a complete column of those "potential" Sums and paste the summands (Matches) one column next to it (or n columns for n summands).
    I tried to change the range and add a "i" loop to it. But it seems that everytime I m doing it, mismatch Data pops up. So I wasnt able to set the Range to the whole column. For instance I tried .Range("B" & iCount) or Range("B:B") or Cells(iCount, 2) and so on
    So my question here is whether I did the syntax wrong or could be problem with the arrays themselves?

    Here is the Code related to setting up the range:
    Please Login or Register  to view this content.
    Here is the whole code, sub + function:
    Please Login or Register  to view this content.
    Please Login or Register  to view this content.


    Thanks for ur help, I really do appreciate it!

  2. #2
    Valued Forum Contributor mohd9876's Avatar
    Join Date
    05-04-2011
    Location
    Amman, Jordan
    MS-Off Ver
    Excel 2010
    Posts
    426

    Re: Knapsack Problem looping through Range

    I think the problem is in this:
    Please Login or Register  to view this content.
    because you are trying to access a non array variable as array; so you should declare it as array or use it as non array

+ 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