Monday 25 March 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

php - file_get_contents shows unexpected output while reading a file

I want to output an inline jpg image as a base64 encoded string, however when I do this : $contents = file_get_contents($filename); print &q...