Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Ayden Smith   on Feb 20 In MS Office Category.

  
Question Answered By: Mohammed Evans   on Feb 20

I sent a non-VBA solution for this already, but if you need to do it in VBA (as
part of a larger procedure or system), the following code  should work:

Sub CompareSheets()
Dim x As Long, retval
On Error Resume Next
Sheets("raw data").Activate
For x& = 5 To 2000
retval = Application.WorksheetFunction.VLookup(ActiveSheet.Cells(x&,
2).Value, Sheets("BU").Range("A2:A10"), 1, False)
If retval = ActiveSheet.Cells(x&, 2).Value Then
ActiveSheet.Cells(x&, 1).Value = retval
End If
Next x&
End Sub

Share: 

 

This Question has 3 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on Another problem with coding Or get search suggestion and latest updates.


Tagged: