Macro that finds data in another .xls file?
I'm quite new to VBA so bare with me...
I'm looking for a macro that will find a piece of text (A1234) in another .xls file, call it "FILE2". I want the macro to check just the A column in "FILE2" and when "A1234" is found to copy the whole row to the file with the macro, "FILE1".
Can someone help me get it working?
Re: Macro that finds data in another .xls file?
Welcome to VBForums :wave:
Thread moved from the 'VB6' forum to the 'Office Development/VBA' forum (while VBA and VB6 have some similarities, they are not the same thing)
Re: Macro that finds data in another .xls file?
Code:
Sub WorkBookReference()
Dim DestinationB, SourceB As String
SourceB = "Book3"
DestinationB = "Book2"
Workbooks(Destination).Worksheets("Sheet1").Range("A1") = Workbooks("Source").Worksheets("Sheet1").Range("A2")
End Sub
I bolded the values you'd have to change
Re: Macro that finds data in another .xls file?
Welcome to the forums Kaitsu :wave:
You can use .FIND to find text in other workbook. See this link on how to use .Find
TOPIC: .Find and .FindNext In Excel VBA
LINK: http://siddharthrout.wordpress.com/2...-in-excel-vba/
Once you get the row of the found value using aCell.Row then you can simply copy that row :)
Give it a try and if you get stuck then simply post the code that you tried and the error that you are getting. We will then take it from there.