PDA

View Full Version : I need Help



parscon
03-08-2012, 03:32 AM
I have 2 WorkBook . My first work book have only 1 sheet but my second work book have 5 sheet .

Now in workbook 1 i have have some numbers that they are also in workbook2 .

i need a macro , when run it ,check the numbers if find the same number in workbook 2 m copy column M to workbook 1 .

But i want search all sheet in workbook 2 . and just copy column M to column M in workbook 1 .

Please help me .

GTO
03-08-2012, 03:55 AM
...Now in workbook 1 i have have some numbers that they are also in workbook2 .

i need a macro , when run it ,check the numbers if find the same number in workbook 2 m copy column M to workbook 1 .

But i want search all sheet in workbook 2 . and just copy column M to column M in workbook 1 .

Please help me .

Hi there,

I think it would be helpful if you zip'd two workbooks (Preferably in .xls format) and attached. The data we're looking through in one, and the expected output in the other.

Mark

parscon
03-08-2012, 04:31 AM
I attached My 2 workbook .

in workbook File1 i have 1 sheet and 1 column . but in workbook File2 i have 4 sheet .

Now in workbook file 1 i have some numbers in column A and also i have some numbers and data on workbook File2 but in 4 sheet .

I need a macro that search the numbers find in workbook file 1 find it also on File2 and if found it copy data column B and C to workbook 1 in column B and C .

Please help me .

Thank you .

mohanvijay
03-08-2012, 07:17 AM
Try this



Dim i As Long
Dim WS_F1 As Worksheet
Dim WS_F2 As Worksheet
Dim F_Rng As Range
Dim T_Str As String
Dim L_Rw As Long

Set WS_F1 = ThisWorkbook.Sheets("A")

With WS_F1
L_Rw = .Cells(Rows.Count, 1).End(xlUp).Row
For i = 1 To L_Rw
T_Str = .Cells(i, 1).Value
For Each WS_F2 In Workbooks("f2").Sheets

With WS_F2

Set F_Rng = .Range("a:a").Find(T_Str, , , xlWhole)
If Not F_Rng Is Nothing Then
F_Rng.Offset(, 1).Resize(, 2).Copy WS_F1.Cells(i, 2)
Exit For
End If
End With
Next
Next i
End With

Set F_Rng = Nothing
Set WS_F2 = Nothing
Set WS_F1 = Nothing

parscon
03-08-2012, 09:46 AM
Thank you very much , it is really very big help for me .

Just i have a question ,if i want to search the number in 3 column (A-B-C) that mean if it find the number in any of these 3 columns and when found the number in any of these 3 column in workbook2, copy the data on column D-E and H (not F and G) to workbook1 .

That mean : in workbook 2 i have the column A-B-C-D-E-F-G-H , when find any numbers that be in Column A-B-C of workBook 2 copy the data on column D-E-H to workbook1 .

Hope you understand .

Thank you again .

Bob Phillips
03-08-2012, 03:28 PM
Can you try and be a bit more descriptive with your thread subject. Subjects like 'Problem' and 'I Need Help' do not help anyone to have any idea whether it is an area that they can help with. We know you need help, why else would you be here?

parscon
03-08-2012, 03:29 PM
Ok , I am so sorry , it will be never happen again . thank you again .