Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How you decimate data using EXCEl (i.e., remove every second or t.

I have a data file (over 9000 rows and 10 columns worth of data), and I would
like to remove every fifth row to reduce the amount of data. How do i
accomplish this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,441
Default How you decimate data using EXCEl (i.e., remove every second or t.

Blue,

Try the macro below.

HTH,
Bernie
MS Excel MVP

Sub RemoveEveryFifthRow()
Dim myRows As Long
Range("A1").EntireColumn.Insert
Range("A1").FormulaR1C1 = _
"=IF(MOD(ROW(),5)=0,""Trash"",""Keep"")"
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


"littlebluesoul" wrote in message
...
I have a data file (over 9000 rows and 10 columns worth of data), and I

would
like to remove every fifth row to reduce the amount of data. How do i
accomplish this?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 252
Default How you decimate data using EXCEl (i.e., remove every second or t.

One way:


Sub DeleteEveryFifthRow()
Dim lRow As Long
lRow = Range("A65536").End(xlUp).Row
Do While lRow 0
Cells(lRow, 1).EntireRow.Delete
lRow = lRow - 5
Loop
End Sub


"littlebluesoul" wrote:

I have a data file (over 9000 rows and 10 columns worth of data), and I would
like to remove every fifth row to reduce the amount of data. How do i
accomplish this?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
decimate rows in Excel 2007 Alistair Excel Discussion (Misc queries) 3 September 30th 11 11:15 PM
How do I remove data in a row in excel without losing all data in lindad Excel Worksheet Functions 1 April 29th 10 07:18 PM
How do I remove the text qualifier (') from my data in Excel? Robert HAI Excel Discussion (Misc queries) 0 October 30th 06 06:05 PM
how do I remove repeated data in excel S. Virgile Excel Worksheet Functions 1 June 27th 06 06:00 PM
Excel 97-remove link but keep data Van Excel Discussion (Misc queries) 3 January 12th 06 08:04 PM


All times are GMT +1. The time now is 03:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"