troubleshooting Question

VBA :Match columns from from workbook A & B, return another column from workbook A to workbook B

15 Comments1 Solution118 ViewsLast Modified:
I have 2 workbooks A & B.The workbooks are already defined.

I have an issue with part of my code where I am trying to compare column A from workbook A and Column D from Workbook B. If it matches then I want to copy corresponding column B to Workbook column E.

I started to write the following code but not sure how to proceed further in comparing the columns and copying as I am fairly new to VBA. I am not trying to match row by row, I am checking the entire column.

Dim strRangeToCheckA As Range
Dim strRangeToCheckB As Range
Dim strRangeToCheckC As Variant

Set strRangeToCheckA = RSC.Sheets("Balance").Range("A:G")
Set strRangeToCheckB = Brostacc.Sheets("Stock").Range("A:U")
Set strRangeToCheckC = Brostacc.Sheets("Stock").Range("U:U")

If Application.VLookup(LookFor, strRangeToCheckA, 2, False) = Application.VLookup(LookFor, strRangeToCheckB, 1, False) Then
  strRangeToCheckC = Application.VLookup(LookFor, strRangeToCheckA, 7, False)
End If

I appreciate the help and Thanks in Advance!
Join our community to see this answer!
Unlock 1 Answer and 15 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 15 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros