My second session macro is not working plzzz help me ((
thank u so much in advance
My second session macro is not working plzzz help me ((
thank u so much in advance
Its very simple. Your 2nd session macro had 2 additional lines of code which were not there in the other sessions.
Just remove the line with "Do" and the "Loop Until". Your code was continuously looping and hence the issue.
Also, your code can be written in a much better way. You can discontinue using Select & Activate statements.
If I have helped, Don't forget to add to my reputation (click on the star below the post)
Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
Use code tags when posting your VBA code: [code] Your code here [/code]
I have edited your code a bit (by removing all the select statements). You can try it out. Also instead of copying the same code 5 times, you could even use a IF loop to choose the respective column to populate / work with and then assign the same macro to all 5 buttons. This is the edited code with the select statements missing.
Please Login or Register to view this content.
Hiiiii thank u sooo much for ur replyyy ))) I also have another question...when I finished writting my "loop until" condition my condition was written in two different lines and that cause a debug how can I get rid of my long "loop until" condition ?
here's for example my 3rd session condition for the loop
Loop Until (Range("D4") <> Range("C4") And Range("D4") <> Range("B4")) And (Range("D5") <> Range("C5") And Range("D5") <> Range("B5")) And (Range("D6") <> Range("B6")) And (Range("D6") <> Range("C6")) And (Range("D7") <> Range("B7")) And (Range("D7") <> Range("C7")) And (Range("D8") <> Range("B8")) And (Range("D8") <> Range("C8")) And (Range("D9") <> Range("B9")) And (Range("D9") <> Range("C9")) And (Range("D10") <> Range("B10")) And (Range("D10") <> Range("C10")) And (Range("D11") <> Range("B11")) And (Range("D11") <> Range("C11")) And (Range("D12") <> Range("B12")) And (Range("D12") <> Range("C12"))
and so on till cell range 28
I guess all you are trying to do is ensure that the values in rows B4 to B28 dont match with C4 to C28 and D4 to D28 row-wise right? I saw that session 2 takes a very long time to run bcoz of the condition. Maybe if you explain how you get the values in sheet3 column B, that might help find a shorter way of doing the loop until code.
Also, you can put this statement -at the beginning of each code andPlease Login or Register to view this content.
at the end. This will eradicate the filter which is an eye-sore specially in the case of Session2.Please Login or Register to view this content.
Hiii :D
thank u for ur reply
in sheet three a create a new column next to the table # column and randomize numbers using the rand() function after that I soft the 2 column in respect of the rand column and copy and paste the randomized sorted table column in the table
How do you get the values in your 2nd column in Sheet 3?
same mechanism rand values...sort the second column in respect to the first column
Oh ok. I didnt see any formula in column B so was wondering.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks