+ Reply to Thread
Results 1 to 3 of 3

Form an array based on criteria and paste to new worksheet

Hybrid View

  1. #1
    Forum Expert Carim's Avatar
    Join Date
    04-07-2006
    Posts
    4,070
    Hi,

    Have you tried Data Advanced Filter ...?
    HTH
    Carim


    Top Excel Links

  2. #2
    Forum Contributor
    Join Date
    07-13-2006
    Posts
    400
    something quick

    you should be able to modify it to suit your needs

    Sub arrayb()
    
        Dim DataArray() As String
        Dim LastRow As Integer
        Dim LastCol As Integer
        Dim i As Integer
        Dim j As Integer
        Dim DataRow As Integer
        
        LastRow = Cells.SpecialCells(xlLastCell).Row
        LastCol = Cells.SpecialCells(xlLastCell).Column
        
        ReDim DataArray(LastRow, LastCol)
        
        
        For i = 1 To LastRow
            If Worksheets("Sheet1").Cells(i, 5) = "B" Then
                For j = 1 To 5
                    DataArray(i, j) = Worksheets("Sheet1").Cells(i, j)
                Next j
            End If
        Next i
        
        
        DataRow = 1
        
        For i = 1 To LastRow
            If DataArray(i, 1) <> "" Then
                For j = 1 To 5
                    Worksheets("Sheet2").Cells(DataRow, j) = DataArray(i, j)
                Next j
                DataRow = DataRow + 1
            End If
        Next i
    End Sub
    Attached Files Attached Files
    --Mark

    Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?

+ 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