5 from 50 Number Generator.

sezuh

Well-known Member
Joined
Nov 19, 2010
Messages
708
hi,
would be possible to have number genarator to assign 10 columns with 5 numbers in each column,but with no 3 consecutive numbers to be assigned in any column at all.and also every time i run the code to give different numbers untill all 50 numbers been used.thank you in advane for any assistance.here an example:
Sheet1

<TABLE style="PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 11pt; FONT-FAMILY: Calibri,Arial; BACKGROUND-COLOR: #ffffff" cellSpacing=0 cellPadding=0 border=1><COLGROUP><COL style="FONT-WEIGHT: bold; WIDTH: 30px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"><COL style="WIDTH: 64px"></COLGROUP><TBODY><TR style="FONT-WEIGHT: bold; FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center"><TD> </TD><TD>A</TD><TD>B</TD><TD>C</TD><TD>D</TD><TD>E</TD><TD>F</TD><TD>G</TD><TD>H</TD><TD>I</TD><TD>J</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">1</TD><TD>correct result</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">2</TD><TD style="TEXT-ALIGN: right">1</TD><TD style="TEXT-ALIGN: right">2</TD><TD style="TEXT-ALIGN: right">3</TD><TD style="TEXT-ALIGN: right">4</TD><TD style="TEXT-ALIGN: right">5</TD><TD style="TEXT-ALIGN: right">6</TD><TD style="TEXT-ALIGN: right">7</TD><TD style="TEXT-ALIGN: right">8</TD><TD style="TEXT-ALIGN: right">9</TD><TD style="TEXT-ALIGN: right">10</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">3</TD><TD style="TEXT-ALIGN: right">20</TD><TD style="TEXT-ALIGN: right">11</TD><TD style="TEXT-ALIGN: right">12</TD><TD style="TEXT-ALIGN: right">13</TD><TD style="TEXT-ALIGN: right">14</TD><TD style="TEXT-ALIGN: right">15</TD><TD style="TEXT-ALIGN: right">16</TD><TD style="TEXT-ALIGN: right">17</TD><TD style="TEXT-ALIGN: right">18</TD><TD style="TEXT-ALIGN: right">19</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">4</TD><TD style="TEXT-ALIGN: right">30</TD><TD style="TEXT-ALIGN: right">29</TD><TD style="TEXT-ALIGN: right">28</TD><TD style="TEXT-ALIGN: right">27</TD><TD style="TEXT-ALIGN: right">26</TD><TD style="TEXT-ALIGN: right">25</TD><TD style="TEXT-ALIGN: right">24</TD><TD style="TEXT-ALIGN: right">23</TD><TD style="TEXT-ALIGN: right">22</TD><TD style="TEXT-ALIGN: right">21</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">5</TD><TD style="TEXT-ALIGN: right">35</TD><TD style="TEXT-ALIGN: right">36</TD><TD style="TEXT-ALIGN: right">31</TD><TD style="TEXT-ALIGN: right">32</TD><TD style="TEXT-ALIGN: right">33</TD><TD style="TEXT-ALIGN: right">34</TD><TD style="TEXT-ALIGN: right">38</TD><TD style="TEXT-ALIGN: right">37</TD><TD style="TEXT-ALIGN: right">40</TD><TD style="TEXT-ALIGN: right">39</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">6</TD><TD style="TEXT-ALIGN: right">42</TD><TD style="TEXT-ALIGN: right">43</TD><TD style="TEXT-ALIGN: right">44</TD><TD style="TEXT-ALIGN: right">45</TD><TD style="TEXT-ALIGN: right">41</TD><TD style="TEXT-ALIGN: right">50</TD><TD style="TEXT-ALIGN: right">48</TD><TD style="TEXT-ALIGN: right">49</TD><TD style="TEXT-ALIGN: right">47</TD><TD style="TEXT-ALIGN: right">46</TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">7</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">8</TD><TD>not correct</TD><TD> </TD><TD> </TD><TD> </TD><TD>correct</TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">9</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">1</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">25</TD><TD style="TEXT-ALIGN: right">6</TD><TD> </TD><TD style="TEXT-ALIGN: right">1</TD><TD style="TEXT-ALIGN: right">2</TD><TD style="TEXT-ALIGN: right">3</TD><TD>></TD><TD>></TD><TD>></TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">10</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">2</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">26</TD><TD style="TEXT-ALIGN: right">11</TD><TD> </TD><TD style="TEXT-ALIGN: right">11</TD><TD style="TEXT-ALIGN: right">20</TD><TD style="TEXT-ALIGN: right">29</TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">11</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">3</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">27</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">42</TD><TD> </TD><TD style="TEXT-ALIGN: right">28</TD><TD style="TEXT-ALIGN: right">31</TD><TD style="TEXT-ALIGN: right">30</TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">12</TD><TD style="TEXT-ALIGN: right">21</TD><TD style="TEXT-ALIGN: right">30</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">43</TD><TD> </TD><TD style="TEXT-ALIGN: right">32</TD><TD style="TEXT-ALIGN: right">33</TD><TD style="TEXT-ALIGN: right">34</TD><TD> </TD><TD> </TD><TD> </TD></TR><TR style="HEIGHT: 18px"><TD style="FONT-SIZE: 8pt; BACKGROUND-COLOR: #cacaca; TEXT-ALIGN: center">13</TD><TD style="TEXT-ALIGN: right">40</TD><TD style="TEXT-ALIGN: right">31</TD><TD style="COLOR: #ff0000; TEXT-ALIGN: right">44</TD><TD> </TD><TD style="TEXT-ALIGN: right">41</TD><TD style="TEXT-ALIGN: right">45</TD><TD style="TEXT-ALIGN: right">48</TD><TD> </TD><TD> </TD><TD> </TD></TR></TBODY></TABLE>
sezuh
 
Thanks,SHG and ENERGMAN for your response,
would it be possible to solve without the constraints of 3 consecutive numbers?
thanks again
sezuh
 
Upvote 0

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.

Forum statistics

Threads
1,224,506
Messages
6,179,159
Members
452,892
Latest member
yadavagiri

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top