View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Sue Sue is offline
external usenet poster
 
Posts: 285
Default UserForm to delete unwated items off sheet?


--
Many Thanks

Sue


"Mike H." wrote:

So if J Smith enters Pools A, B, C AND D only, for example, can he have more
than one fish caught in each pool? How do you determine which pool to put
which fish? Not sure I understand how you enter the information. But to
make sure I understand what you desire. You want to know the top 3 heaviest
fish in each pool, right?


Hi Mike

Thanks for prompt reply

I know its not easy to explain so If I just use column "K" and the letter
"A" J. Bloggs has weighed in his catch he maybe the 21st out of 60 to weigh
in and he has pooled in "A" when sorted in Column "J" he is 1st so he gets
50% J.Smith when he weighs in his fish he might be 33rd out of 60 and when
sorted he ends up in 9th position overall however nobody between 2nd & 8th is
in pool "A" so he would draw 30% & ANother is 12th overall 10th and 11th are
not in pool "A" so ANother draws 20%. All other "A's" in column "K" would be
deleted because all the Prize Money in pool "A" has been allocated and so on
through columns L to Q because using letters. I found the code below in this
forum that puts the money totals where "A" is and I adapted it for each
Column on separate commandbuttons.



Sub Add500_Click()

Dim v(1 To 3), rng As Range, rng1 As Range
Dim sAddr As String, ii As Long
Set rng = Worksheets("InputData").Range("K6:K40")
Set rng1 = rng.Find(What:="A", _
After:=rng(rng.Count), _
LookIn:=xlValues, _
LookAt:=xlWhole, _
SearchOrder:=xlByRows, _
SearchDirection:=xlNext, _
MatchCase:=False)
If Not rng1 Is Nothing Then
v(1) = Evaluate(Me.Tb601.Text)
v(2) = Evaluate(Me.Tb602.Text)
v(3) = Evaluate(Me.Tb603.Text)
ii = 1
sAddr = rng1.Address
Do
rng1.Offset(0, 0).Value = Application.Large(v, ii)
Set rng1 = rng.FindNext(rng1)
ii = ii + 1
Loop Until rng.Address = sAddr Or ii 3
Else
MsgBox Range("K1").Value & " was not found"
End If

End Sub