View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
joel joel is offline
external usenet poster
 
Posts: 9,101
Default UserForm to delete unwated items off sheet?

I used column J to determine where the last row is. The code checks columns
K thru Q and removes any entry after the third item on each row.


Sub clearcolumns()

LastRow = Range("J" & Rows.Count).End(xlUp).Row
StartCol = Range("K6").Column
EndCol = Range("Q6").Column
For RowCount = 6 To LastRow
Count = 0
For ColCount = StartCol To EndCol
If Cells(RowCount, ColCount) < "" Then
If Count 3 Then
Cells(RowCount, ColCount) = ""
Else
Count = Count + 1
End If
End If
Next ColCount
Next RowCount
End Sub


"Sue" wrote:

Hi All

We are an Angling Club and when we have Matches the entrants can enter
various Pools
which are listed on the entry form as A,B,C,D,E,F,G - on a UserForm I enter
all the entrants
details name etc plus what pools they have entered in Textboxes the pools
are entered in
columns K : Q starting at row 6 e.g. J. Bloggs A,B,C, - next row -- J. Smith
A,B,C,D, etc -- an Angling Match
is decided by the weight caught by each individual Angler the weights are
sorted in column J
highest to lowest. We only payout 3 prizes in each pool 50%,30%,20% -- my
problem is that
on the sheet there will be many A,B,C,D,E,F,G entries some with blank cells
in between in each of the columns
and all I need is the first 3 A's B's etc and I need all the others deleted
is it possible that someone can
help with a macro that would do this for me.
--
Many Thanks

Sue