Q:
Copy Specific rows to new sheet when multiple row names match
I have a sheet that looks like this:
Column A Column B
Name Name
Fred Joe
Joe Fred
Joe Joe
Joe Joe
I need to identify the 3 rows, specifically the 3 rows where the name is Joe and then copy them to a new sheet.
I am using an XLAM macro and trying to use:
Sub MoveOne()
ActiveWorkbook.Sheets("One").Activate
Range("A:A").Select
Selection.SpecialCells(xlCellTypeVisible).Copy
Sheets("Two").Select
Range("A:A").Select
Range("A1").End(xlDown).Offset(1).Select
Range(Selection, Selection.End(xlToLeft)).Select
Range(Selection, Selection.End(xlDown)).Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Offset(0, 1).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=True
End Sub
I get this error:
I have also tried the suggestion to make a copy and paste within the sub but I have the same error.
A:
if you have the same row title's in column A, you can use the code below
Option Explicit
Sub CopyOne()
Dim wsData As Worksheet
Dim wsDest As Worksheet
Set wsDest = ThisWorkbook.Worksheets("Sheet2")
For Each wsData In ThisWorkbook.Worksheets
If wsData.Name = "Name" Then
wsData.Range("A1").EntireRow.Copy ac619d1d87
Related links:
Comments