I have two columns: column (A) and column (B) in a spreadsheet.
Column (A) contains the names extracted from the query (for example, Brian, Bob, Bill, etc.), and column (B) contains one of three statuses (Assignment, Execution, or Pending).
However, this query sometimes pulls out some items indicating "Assigned" for a status with no name, so the corresponding cell representing the name in column (A) is empty. Therefore, I manually fill in these empty Unknown cells.
What I want to do is create a macro that finds every empty cell in column (A) and fill in the word "Unknown" if the cell on the right is in the word "Assinged".
Thus, the conditions:
This is my code:
Private Sub CommandButton2_Click()
For Each cell In Columns("A")
If ActiveCell.Value = Empty And ActiveCell.Offset(0, 1).Value = "Assigned" Then ActiveCell.Value = "Unknown"
Next cell
End Sub
source
share