I have been trying to get a macro to create a new column for me in a spreadsheet that I'm building. It will take either a yes or no from column K and, depending on whether it is yes or no, will populate the new column with Pending or Pipeline.
The following is the code I have been using - but this just marks everything as Pipeline:
Dim KR As Long KR = ActiveSheet.Range("K" & Rows.Count).End(xlUp).Row Range("M1").EntireColumn.Insert Range("M1").Select ActiveCell.FormulaR1C1 = "Status" If Range("K2").Value = "No" Then Range("M2").Value = "Pipeline" ElseIf Range("K2").Value = "Yes" Then Range("M2").Value = "Pending" End If Range("M2").Copy Destination:=Range("M3:M" & KR)
Where have I been going wrong?
Aucun commentaire:
Enregistrer un commentaire