Results 1 to 18 of 18

Select range of data based on values in colum A

Threaded View

  1. #1
    Registered User
    Join Date
    01-06-2016
    Location
    Derbyshire, England
    MS-Off Ver
    2013
    Posts
    18

    Select range of data based on values in colum A

    I have several large sets of data in one spreadsheet and would like to split them into different sheets. For each set of data, the values within column A are identical and amount to approximately 40,000 rows for each data set.

    I have found a macro which compares the active cell to the next cell and moves down the rows until the numbers change. At this point it should stop, but it doesn't. The macro is:

    Sub testIt()
    Dim r As Long, endRow As Long, pasteRowIndex As Long
    
    endRow = 1000001 ' of course it's best to retrieve the last used row number via a function
    pasteRowIndex = 1
    
    For r = ActiveCell To endRow 'Loop through sheet1 and search for your criteria
    
    If Cells(ActiveCell).Value = Cells(ActiveCell.Offset(1, 0)).Value Then 'Found
    
            'Select next
            ActiveCell.Offset(1, 0).Select
            
            
    
    End If
    Next r
    End Sub
    Even if this worked, I am sure it would take an age to go through all 40,000 rows for the data set. And a lifetime for all 2,000 data sets that it needs to go through.

    Can anyone recommend a quick way of exporting each data set into a different sheet? If not please fix the macro above.

    Many thanks
    Attached Files Attached Files
    Last edited by eddiej90; 01-06-2016 at 09:36 AM. Reason: Attachment added

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] How to Select Worksheet and Cell/range based on ComboBox Values
    By ckarlest in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-02-2014, 10:54 AM
  2. Macro to sum values in one column based on data in another colum while ignoring blanks
    By The Machinist in forum Excel Programming / VBA / Macros
    Replies: 16
    Last Post: 11-15-2012, 03:25 PM
  3. [SOLVED] Colum count based ón values In colum a and b
    By 2001jesper in forum Excel General
    Replies: 16
    Last Post: 11-05-2012, 03:28 PM
  4. Select unknown range and sorte by colum
    By Armitage2k in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-13-2009, 09:10 AM
  5. How to shift range of values from a colum to another colum at a programmed cell.
    By lolypop in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-12-2007, 06:24 PM
  6. How to select a range based on values in 1 column
    By ForestRamsey in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-30-2005, 12:05 PM

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