Home |
Search |
Today's Posts |
#1
|
|||
|
|||
excel formulae
I want to take out 90% of the rows, in order to have a more workable number
of rows. How do i eliminate rows at random, i.e. not me selecting? |
#2
|
|||
|
|||
Try the macro below, which will keep _about_ 10% of the rows - that the nature of randomness ;-)
HTH, Bernie MS Excel MVP Sub Keep10ishPercent() Dim myRows As Long Range("A1").EntireColumn.Insert Range("A1").FormulaR1C1 = _ "=IF(RAND()*10<=1,""Keep"",""Trash"")" myRows = ActiveSheet.UsedRange.Rows.Count Range("A1").Copy Range("A1:A" & myRows) With Range(Range("A1"), Range("A1").End(xlDown)) .Copy .PasteSpecial Paste:=xlValues End With Cells.Select Selection.Sort Key1:=Range("A1"), Order1:=xlAscending Columns("A:A").Find(What:="Trash", After:=Range("A1")).Select Range(Selection, Selection.End(xlDown)).EntireRow.Delete Range("A1").EntireColumn.Delete End Sub "zemarko" wrote in message ... I want to take out 90% of the rows, in order to have a more workable number of rows. How do i eliminate rows at random, i.e. not me selecting? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Stop Excel Rounding Dates | Excel Discussion (Misc queries) | |||
Hints And Tips For New Posters In The Excel Newsgroups | Excel Worksheet Functions | |||
How Do I open an excel file without Excel Viewer support | Excel Discussion (Misc queries) | |||
Excel error - Startup (and Acrobat PDFMaker) | Setting up and Configuration of Excel | |||
Excel 2002 and 2000 co-install. Control Which Starts ? | Excel Discussion (Misc queries) |