View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
No Name
 
Posts: n/a
Default How do I Freeze information to keep from updating

Dick

Thanks for you insight to this question of mine. However I
did what you said and entered this code you posted, only
to incurr a run time error 1004 ~Method Range of
object_Glodal Failed~ @ With Range("Die " & i). Any
thoughts?

If I take out the space between With Range("Die " & i) to
look like this ("~With Range("Die" & i)~"), then the macro
will work but the checkboxes won't preform the hold
function.

Thanks for your help.
Pete

-----Original Message-----
Pete

Do you have checkboxes next to the ranges? Are those

checkboxes linked to
cells?

Let's say you have five checkboxes next to Die1 - Die5

and those checkboxes
are linked to the cells just to the right of Die1-Die5.

Now your macro
could look like this

Sub ShipCaptCrew()
Dim i as Long
For i = 1 to 5
With Range("Die " & i)
If Not .Offset(0,1).Value Then
Randomize
.Value = Int(Rnd() * 6) + 1
End If
End With
Next i
End Sub

This will look at the cell to the right of Die x (.Offset

(1,0)) and if it's
Not TRUE (Check box wasn't checked), then it will replace

it's value with a
new random number.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.

"Pete" wrote in

message
...
I created a macro to preform this function below. Once
that function is preformed the user has the option of
keeping all or some of the returned data.

How do I make the macro only look at the valid unkeept
data to change. I put in a "check box form" to let the
user select the data to keep, but how do I tell the

macro
to ignor that portion of the spread sheet?

Sub ShipCaptCrew()
Randomize
Dim NextRow As Long
Range("Die1") = Int(Rnd() * 6) + 1
Range("Die2") = Int(Rnd() * 6) + 1
Range("Die3") = Int(Rnd() * 6) + 1
Range("Die4") = Int(Rnd() * 6) + 1
Range("Die5") = Int(Rnd() * 6) + 1

Any help will be great.
Thanks
Pete W.



.