I need help with creating a macro that will populate two other columns based on text criteria from column A. For example, if specific the text in column A matches "abc.com", then column B should be populated with "fakecompany1" and column C with "fakesegment1".
I tried to go with the code below to at least have column B populated, but the problem is that this way the value is locked in the cell and when cell value changes (which it with every new export) it will show "n/a" instead of identifying specific value in the entire column and when i tried to add "and" for the column C to be populated it was returning errors. So i need a code that will query whole column A for "abc.com" and then based on that will populate column B with "fakecompany1' and column C with "fakesegment1".
- Sub populateBnC()
- If Worksheets("Sheet1").Cells(2, 1).Value = "abc.com" Then
- Worksheets("Sheet2").Cells(2, 2).Value = "fakecompany1" And Worksheets("Sheet2").Cells(2, 3).Value = "fakesegment1"
- Worksheets("Sheet2").Cells(2, 2).Value = "n/a" And Worksheets("Sheet2").Cells(2, 3).Value = "n/a"
- End If
- End Sub
Thank you for your help