+ Reply to Thread
Results 1 to 4 of 4

data reduction

Hybrid View

  1. #1
    Registered User
    Join Date
    10-05-2007
    Posts
    24

    data reduction

    I have a text file that I need to reduce by deleting rows of data.

    I get the data file which I am able to open just like I would a .csv file.

    Each of these files contains the results for 5 parts on average, the sample below only has 2.

    I need to reduce the rows of data per part by keeping only every fifth row of data.

    I have attatched a sample of the file I need to reduce
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    03-24-2008
    Posts
    11
    You need a simple macro to do it. How is your VBA?

  3. #3
    Registered User
    Join Date
    10-05-2007
    Posts
    24
    my VBA is not very good.

  4. #4
    Registered User
    Join Date
    03-24-2008
    Posts
    11
    You can use a macro similar to the following
    Sub reduce_data()
        
        Dim first_cell As Range
        Dim last_row As Long
        
        
        last_row = ActiveCell.End(xlDown).Row
        
        While (ActiveCell.Row <= last_row - 5)
            ActiveCell.Offset(1, 0).Select
            For i = 1 To 5
                ActiveCell.EntireRow.Delete
                last_row = last_row - 1
            Next
    
        
        Wend
        
        
        
    End Sub
    Select any cell on first row of your data and run it. It will keep fifth row till it reaches the first empty row.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1