开发者

Macro that fills column based on two other columns equating

I am new to writing macros and I have no clue on how to write this. I need a macro that compares text in column A of workbook A to column B in Workbook B. If they match, then it would use the data in Column D on that same row of workbook A and place it in Column C of workbook B. If no matches were found, then it would say "No Match". How would I create this? An example is below:

            Workbook A                                        Workbook B
     Column A  Column B开发者_Go百科  Column D                Column A   Column B   Column C
      Smith      --       Name                    ---        Point      No Match        
      Lane       --       Street                  ---        Smith      Name 
      Happy      --       Emotion                 ---        123        Numbers
      123        --       Numbers                 ---        Valid      No Match 


You won't need macros to do this. All you will need is an if condition something like this

=IF('[WorkbookName1.xlsx]Sheet1'!A1='[WorkbookName2.xlsx]Sheet2'!B1, '[WorkbookName1.xlsx]Sheet1'!D1, "No Match")

Just drag that formula down (or create it in vba with ".Formula = ") for all of the cells in column C. Let me know if you need help with adding the formulas to the correct cells from VBA if that is indeed necessary

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜