Copying data from one sheet to another conditionally [Solved/Closed]

sorceres13 2 Posts Tuesday March 4, 2014Registration date March 5, 2014 Last seen - Mar 4, 2014 at 02:04 PM - Latest reply: sorceres13 2 Posts Tuesday March 4, 2014Registration date March 5, 2014 Last seen
- Mar 5, 2014 at 10:41 AM
Hi gang,
I have a spreadsheet with columns A thru H being populated with text. I need to copy columns A thru H from spreadsheet 1 to spreadsheet 2 if column A = to "PT". Should I be using a macro for this or an IF statement? Any help is greatly appreciated. I don't know how to create the macro and have tried the IF statement but seems like I have to create an IF state for each column

Thanks

More info:
Rows look like this:
PT ACB 1 45455550112 COMPUTER, MICRO LAP-TOP PORTABLE AC: 6910P HEWLETT PACKARD 1 130 130 Ea


So If A:A = "PT" then I need to copy the entire row to the next sheet. There may be several rows that have A:A = "PT"

Thanks
See more 

2 replies

Best answer
venkat1926 1865 Posts Sunday June 14, 2009Registration dateContributorStatus July 30, 2015 Last seen - Mar 4, 2014 at 11:07 PM
1
Thank you
PT is column A
data in sheet is from A1
no blank rows or columns

try this macro

Sub test()
Dim r As Range, filt As Range
Application.ScreenUpdating = False
With Worksheets("sheet1")
Set r = .Range("a1").CurrentRegion
r.AutoFilter field:=1, Criteria1:="PT"
r.SpecialCells(xlCellTypeVisible).Copy
With Worksheets("sheet2")
.Range("A1").PasteSpecial
End With
.AutoFilterMode = False
End With
Application.CutCopyMode = False
Application.ScreenUpdating = True
End Sub

Thank you, venkat1926 1

Something to say? Add comment

CCM has helped 1300 users this month

Best answer
sorceres13 2 Posts Tuesday March 4, 2014Registration date March 5, 2014 Last seen - Mar 5, 2014 at 10:41 AM
1
Thank you
Thank you soo much that works beautifully. I appreciate the help

Thank you, sorceres13 1

Something to say? Add comment

CCM has helped 1300 users this month