Copying to another sheet and missing out lines

rireland

Board Regular
Joined
Feb 12, 2004
Messages
64
My main sheet has the results of a competition in rows 1-100. 75% of the results won't count for the jumpoff ( its a horsey competition) and I want to automatically copy the successful details to another sheet. I've worked out how to to omit the unsuccessful results by using an IF statement ( IF cellx is > x then copy ) but I still end up with 100 rows - with 25 results and 75 blank rows. How can I copy but compact it down to 25 rows.

As a second question I need to sort the results. I know how to do a manual sort & I even worked out a macro so one keystroke can do the sort. It woruld be better if the sort would be automatic whenever there is a change in the scores.
 
Hi Richard I've sent you a private message.

If you wan't to switch off the macro delete it, draw a button on your scores sheet by going to menu View / Toolbars / Control Toolbox - Command Button draw it onto your sheet with the mouse. Double click the button you have just drawn, and paste the code below in to the button click macro between Private Sub CommandButton1_Click() and the End Sub lines. Ive updated the code with your new sort ranges.

Code:
Worksheets("Results").Range("A3:N50").Sort Key1:=Worksheets("Results").Range("F3"), Order1:=xlAscending, Key2:=Range("A3"), Order2:=xlAscending, Header:= xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal


This way the code will run once when you click the button, not each time you change a cell.

JB.
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hi Richard,

Oops, just seen an error in my code. Second sort key range was wrong and should have been prefixed with Worksheets("Results"). This would have caused the error you were talking about.

New code:
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Worksheets("Results").Range("A3:N50").Sort Key1:=Worksheets("Results").Range("F3"), Order1:=xlAscending, Key2:=Worksheets("Results").Range("A3"), Order2:=xlAscending, Header:= xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom, DataOption1:=xlSortNormal
End Sub

Put that in your Scores Worksheet code. Hope tht now works.

JB.
 
Upvote 0

Forum statistics

Threads
1,223,248
Messages
6,171,027
Members
452,374
Latest member
keccles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top