Range question

  • Thread starter Thread starter strataguru
  • Start date Start date
S

strataguru

And to update....

I'd like range A1 through AQ188 - how do I pass that into a range?
These values are dynamic and can change at any time.

Thanks
 
You would specify the maximum row number (188) and column number (whatever AQ
is -- I don't know off hand) as arguments and substitute these for X in a
statement like Rnd()*X
 
Hi: Stataguru

Not to sure where you are with this or what you want to
to accomplish. The following will place the cellpointer
randomly in the location you indicated.

Private Sub CommandButton1_Click()

Dim cnum As Integer
Dim rnum As Integer

'/ generate a random number up to n
'/ change the (Rnd * n) to encrease
'/ the random output dimension
Randomize
cnum = Int(Rnd * 43 + 1)
rnum = Int(Rnd * 188 + 1)

MsgBox "The column number is " & cnum & " and the" _
& " row number is " & rnum & ".", , "Good Luck TK"

Worksheets("Sheet1").Cells(rnum, cnum).Select

End Sub

Good Luck
TK
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top