................................
................................
Last edited by Martin Lorentzen; 01-15-2016 at 03:00 PM.
Do you have headings? When the looping stops, what do you want to have done? Highlight the values used - show a message about the values chosen? Show the value that does not fit? And where is the max capacity value stored, or is it an input from the user? Anyway, looping is done like this
![]()
Please Login or Register to view this content.
Bernie Deitrick
Excel MVP 2000-2010
................................
Last edited by Martin Lorentzen; 01-15-2016 at 03:01 PM.
Would be so cool if you could adjust the code with the new information, and then i could try to build on it myself.
Or maybe some other expert would like to help?
Have a good day!
![]()
Please Login or Register to view this content.
Thank you Bernie, it is much appreciated.
Though i get an error 13 mismatch on this line, so it seems one of the variables should be another type? I tried changing it a bit, but doesn't seem to work.![]()
Please Login or Register to view this content.
Is it possible that you have blanks in your columns? This should work....
![]()
Please Login or Register to view this content.
................................
Last edited by Martin Lorentzen; 01-15-2016 at 03:01 PM.
Because the max wasn't reached.
Change
to![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
Perfect. It works. I will change it to solved. Thanks again!![]()
Hi. I am just coming back to this code again. The below code works perfectly, but it only executes in the active sheet and i want it to execute in all my sheets.
Is there a simple way to add that?
![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
Perfect. You are the best!
Let's say that instead of picking the largest value, it should just pick a random (positive 0<) cell in the same range, and afterwards do the same looping. Would that need a lot of changing in the codes?
Last edited by Martin Lorentzen; 01-14-2016 at 12:36 PM.
![]()
Please Login or Register to view this content.
Hmm, this is weird. My excel goes into "not responding" every time i try to run the code?
Can you post a (sanitized if needed) version of your workbook that shows the behavior?
But I just made a new module and posted the exact same code you did in there. There is nothing else. Only in the other modules, but that shouldn't have any effect on it right? Since I am only running this one![]()
................................
Last edited by Martin Lorentzen; 01-15-2016 at 03:00 PM.
The code below works fine for me - here it is in a working workbook:
Book4.xlsm
![]()
Please Login or Register to view this content.
Last edited by Bernie Deitrick; 01-14-2016 at 03:28 PM.
Hmm that is so weird. Did you try running the code in my sample file, does it work for you there?
I think it has something to do with the max capacity. I tried copying line after line into your sheet, it could do exactly the same until i copied all of row 4 into your workbook, then it gave the same error.
So the error lies within row 4, but what it is i dont know :/
The issue was that the find needed to be forced to look at whole values
![]()
Please Login or Register to view this content.
Thank you so much Bernie. You are so coolSetting to solved again
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks