View Full Version : [SOLVED:] VBA - Find Specific words from Column "A" and paste to column "H"
sanju2323
02-28-2015, 10:22 PM
need find specific word "TP", "IL" column "A" to Copy range "B:F" and past to Column "H"
jolivanes
02-28-2015, 11:29 PM
You could try this on a copy of your workbook.
Sub Filter_Multiple_Values()
Application.ScreenUpdating = False
If Sheets("Sample").AutoFilterMode = True Then Sheets("Sample").AutoFilterMode = False
Sheets("Sample").Range("A2:F" & Cells(Rows.Count, "A").End(xlUp).Row).AutoFilter Field:=1, Criteria1:=Array("IL", "TP"), Operator:=xlFilterValues
Range("B3:F" & Cells(Rows.Count, 1).End(xlUp).Row).SpecialCells(12).Copy Range("H3")
Sheets("Sample").AutoFilterMode = False
Application.ScreenUpdating = True
End Sub
sanju2323
03-01-2015, 12:24 AM
Thank you sir, It works great
sanju2323
03-01-2015, 03:09 AM
Sir, Is that possible generate (paste) Data other sheet ex. Sheets("Sheet2").Range("H3")
and all Paste Special value format Ex .PasteSpecial xlPasteValuesAndNumberFormats
jolivanes
03-01-2015, 04:35 PM
When you used the macro recorder, what did you get?
Post that code if it does not work so we help you cleaning it up.
sanju2323
03-01-2015, 04:58 PM
Sir, Code is work no issue, but this code show result as just like cut past formate. I need past special value format.
jolivanes
03-01-2015, 09:43 PM
Like this?
Sub Filter_Multiple_Values_A()
Application.ScreenUpdating = False
If Sheets("Sample").AutoFilterMode = True Then Sheets("Sample").AutoFilterMode = False
Sheets("Sample").Range("A2:F" & Cells(Rows.Count, "A").End(xlUp).Row).AutoFilter Field:=1, Criteria1:=Array("IL", "TP"), Operator:=xlFilterValues
Range("B3:F" & Cells(Rows.Count, 1).End(xlUp).Row).Copy
With Sheets("Sheet2").Range("C2") '<---- Change Sheet Name and Cell reference as required
.PasteSpecial xlPasteValues
.PasteSpecial xlPasteFormats
End With
Sheets("Sample").AutoFilterMode = False
Application.ScreenUpdating = True
End Sub
sanju2323
03-01-2015, 10:26 PM
Sir, Thank you for cooperation. this time its perfect work as per my requirement.
jolivanes
03-01-2015, 11:24 PM
Thank you for letting us know.
Good Luck
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.