PDA

View Full Version : Sleeper: VBA code for random numbers generation and sorting problem



alihadi
08-15-2015, 03:24 AM
Hi everyone,

Does anyone know how to generate random numbers between (1 & 4) with no repetition and sort them ascending using VBA excel without removing blank cells? I want to generate the numbers randomly in column (A) in random cells and sort them without removing the blank cells like in column (B) as shown in the attached excel file as an example. so I want the random numbers that have been generated with no repetition in column (A) to be sorted ascending in VBA without removing the blank cells as as shown in column (B).
I will be very grateful if you assist me in this matter.

Regards
Ali

alansidman
08-15-2015, 07:22 PM
I am confused by your spreadsheet. You ask that random number be generated between 1 and 4 with no duplicates, but your SS has numbers greater than 4 and has duplicates. Perhaps you should re-explain what you are trying to do in a simplified manner.

alihadi
08-16-2015, 12:47 AM
Hi,
Sorry about being confused.
Please see the attached excel file taking into consideration the explanation in the first post.

Thanks
Ali

mikerickson
08-16-2015, 11:35 AM
If you are randomly choosing four numbers between 1 and 4 without duplicates and then sorting them (ascending) there is only one possible result.

alihadi
08-16-2015, 04:12 PM
If you can please provide a code in VBA for that.

Thanks
Ali

snb
08-17-2015, 12:50 AM
Please stop this nonsense thread.