Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel,microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
The below code is for drawing random numbers between 1-35 (not repeating). The drawn number is being displayed in A1 and at the same time beeing added on column B1:B35 as the macro is executed repetedly via a control button. So far so good. But I need to add a new dimension to this code: I am also displaying the numbers 1...35 on column C1:C35 and as I go along selecting random numbers via the macro, I want the drawn number on column C to disappear one after the other as well...How is this achieved? TIA ---------------------- Sub Rast() Dim say As Integer Dim ara As Range Dim RS As Integer say = WorksheetFunction.CountA(Range("B1:B35")) + 1 If say = 36 Then Exit Sub Randomize again: RS = Int((Rnd * 35) + 1) For Each ara In Range("B1:B" & say) If ara.Value = RS Then GoTo again End If Next ara Range("A1") = RS Cells(say, 2) = RS End Sub ---------------------------------------- --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.714 / Virus Database: 470 - Release Date: 02.07.2004 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to add 130% to a selected range of numbers ? | Excel Discussion (Misc queries) | |||
Move selected Text/Numbers from Col D to Col A/B | Excel Discussion (Misc queries) | |||
Inserting Text Makes Numbers Disappear! | Excel Discussion (Misc queries) | |||
add page numbers to selected sheets | Excel Worksheet Functions | |||
Add selected numbers in a column that are a different color | Excel Discussion (Misc queries) |