View Single Post
 
Old 06-13-2018, 09:19 PM
Logit Logit is offline Windows 10 Office 2007
Expert
 
Join Date: Jan 2017
Posts: 587
Logit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the roughLogit is a jewel in the rough
Default

.
Here is a macro method :

Code:
Option Explicit

Sub CopyYes()
    Dim c As Range
    Dim j As Integer
    Dim Source As Worksheet
    Dim sTarget As Worksheet

    ' Change worksheet designations as needed
    Set Source = ActiveWorkbook.Worksheets("Sheet2")
    Set sTarget = ActiveWorkbook.Worksheets("Sheet1")
    
    sTarget.Range("A3:B1000").Value = ""
    Application.ScreenUpdating = False
    j = 3     ' Start copying to row 1 in target sheet
    For Each c In Source.Range("A2:A1000")   ' Do 1000 rows
        If c = sTarget.Range("A2").Value Then
           Source.Rows(c.Row).Copy sTarget.Rows(j)
           j = j + 1
        End If
    Next c
    Application.ScreenUpdating = True
End Sub

Sub clrall()
Dim sTarget As Worksheet
Application.ScreenUpdating = False
    Set sTarget = ActiveWorkbook.Worksheets("Sheet1")
    sTarget.Range("A3:B1000").Value = ""
Application.ScreenUpdating = True
End Sub
Attached Files
File Type: xlsm AutoList.xlsm (19.3 KB, 10 views)
Reply With Quote