Monday, March 25, 2019

excel - Copy cells from one sheet to another based on criteria in another cell

I am wanting to use VBA to copy cells from one sheet to another sheet in the same workbook based on if the criteria of certain cells match in both sheets.




Example:
If Sheet1!A1 = Sheet2!A1 Then Copy Sheet1!B1 To Sheet2!B2



I could do it via a function: =IF($A1=Sheet1!$A1, VLOOKUP(Sheet1!$A1, Sheet1!$A1:$D1, 2),"")
but am at a loss to make it work in VBA. I thought about an IF|ELSE Statement but couldn't get it to work.

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...