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

Posts
2
Registration date
Tuesday March 4, 2014
Last seen
March 5, 2014
- - Latest reply: sorceres13
Posts
2
Registration date
Tuesday March 4, 2014
Last seen
March 5, 2014
- 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
Posts
1862
Registration date
Sunday June 14, 2009
Status
Contributor
Last seen
July 30, 2015
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

Say "Thank you" 1

A few words of thanks would be greatly appreciated. Add comment

CCM has helped 2730 users this month

Posts
2
Registration date
Tuesday March 4, 2014
Last seen
March 5, 2014
1
Thank you
Thank you soo much that works beautifully. I appreciate the help

Say "Thank you" 1

A few words of thanks would be greatly appreciated. Add comment

CCM has helped 2730 users this month