View Single Post
  #5   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?

Hi Joel

Tried very hard to get your code working it is only clearing the contents of
columns "O,P,Q" and removing everything in those columns and I had to put a
letter in every cell it would not run at all if there are any blank cells in
the column.
Any idea's much appreciated
--
Many Thanks

Sue


"Joel" wrote:

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