asked on # Remove rows containing 2 or more numbers from different decis

The idea is to create a script that removes rows where there are 2 or more numbers from different "decis". A deci is defined as numbers from 1-9, 10-19, 20-29, 30-39, 40-49, 50-59, 60-69, 70-79, 80-89, and 90-99,

There should be:

1) a prompt would ask for input of "Maximum numbers allowed from different decis" or something similar. If the input is one (1) then

2) choose the sheet to be processed

3) sheet "Numbers_3" would be edited as follows:

This process should be able to be repeated for any sheet similar to "Numbers_3"

Notice how all the green rows contain number from only 1 "deci". That is the goal.

Remove-rows-with-2-or-more-numbers-.xlsb

There should be:

1) a prompt would ask for input of "Maximum numbers allowed from different decis" or something similar. If the input is one (1) then

2) choose the sheet to be processed

3) sheet "Numbers_3" would be edited as follows:

This process should be able to be repeated for any sheet similar to "Numbers_3"

Notice how all the green rows contain number from only 1 "deci". That is the goal.

Remove-rows-with-2-or-more-numbers-.xlsb

Microsoft OfficeVBAMicrosoft Excel

Are you saying that 3-4-10-11-20 which was valid in the last question is not valid now because there is more than one decie with 2 or more entries? And are you also saing that this should happen only if the "Maximum numbers allowed from different decis" choice is 1?

Are you saying that 3-4-10-11-20 which was valid in the last question is not valid now because there is more than one decie with 2 or more entries?

correct.

And are you also saing that this should happen only if the "Maximum numbers allowed from different decis" choice is 1?

not sure How to answer this. But since 3-4 and 10-11 are 2 numbers from different “decis” they should be removed. it’s similar to the last script except this time it’s numbers from different decis.

BTW. You can use the last script and just add this to it if it’s easier.

What should happen if you enter 3 or more as "Maximum numbers allowed from different decis", since in a 5-cell set there can't be more than one deci with 3 or more?

Should I not even ask the "Maximum numbers allowed from different decis" question and assume it's always 2?

Should I not even ask the "Maximum numbers allowed from different decis" question and assume it's always 2?

The first is not possible.

The second is correct. No need to ask the question since there can only be a maximum of 2 from same ”deci”.

View this solution by signing up for a free trial.

Members can start a 7-Day free trial and enjoy unlimited access to the platform.

Is it possible to merge this and the last script so they’ll run one after the other? Or will that be too much overhead?

The one that's highlighted. Notice that you have "All Open Workbooks" selected and that the two macros that start with 'Mega are not in my workbook.

It should be fairly easy to do.

This does not do the combined search yet that you asked for. Instead it's a version of my previous workbook that runs in about 8 __seconds__!

Again Numbers_3 is done but now you won't have a problem doing it again.

29173375a.xlsb

Again Numbers_3 is done but now you won't have a problem doing it again.

No worries. I’d rather get that error. I got it on the previous one also. It alerts me that the sheet was already processed.

The request for combined version has been posted. I have reset 3 and 7 and added 4 and 8 for testing purposes, if needed.

Hi

I had a go at this just for fun. This runs the deletion in about 1 and a half minutes by first sorting so that all the deletion can be done in one hit.

It sorts back to the original order afterwards.

It assumes columns F and G are always blank and uses them for sorting.

Run the sub called main to test it out.

This may or may not be helpful. I haven't looked at the other solutions provided but posting it here just it case anyone wants it.

Remove-rows---via-sort-method.xlsb

I had a go at this just for fun. This runs the deletion in about 1 and a half minutes by first sorting so that all the deletion can be done in one hit.

It sorts back to the original order afterwards.

It assumes columns F and G are always blank and uses them for sorting.

Run the sub called main to test it out.

This may or may not be helpful. I haven't looked at the other solutions provided but posting it here just it case anyone wants it.