Hi All,
I need a piece of code that search a specific string in a worksheet if find then copy the column to master sheet on specific column. i need it for multiples strings how it can be?
Thanks
farrukh
Hi All,
I need a piece of code that search a specific string in a worksheet if find then copy the column to master sheet on specific column. i need it for multiples strings how it can be?
Thanks
farrukh
you can either use vlookup or a sql statement on the main file in VBA.
Will you please provide some example please?
cheers
[vba]Sub CopyCol()
Dim arr(), a
Dim ws As Worksheet
Dim i As Long
Dim c as Range
Set ws = Sheets(2)
arr = Array("aaa", 2, "bbb", 5, "ccc", 7, "ddd", 12)
For i = 0 To UBound(arr) - 1 Step 2
Set c = ActiveSheet.Cells.Find(arr(i))
If Not c Is Nothing Then c.EntireColumn.Copy ws.Cells(1, arr(i + 1))
Next
End Sub[/vba]
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Hi mdmackillop,
Perfect this is what i need too...
Thank you have a great time...
Cheers