Hoping someone can help me with this -
I basically have a sheet that includes data like so:
And I need a Worksheet_Change macro that runs through column "A" and deletes any data after the last hyphen, if the data corresponds to a list like so:
Can someone help?
I found this macro which does a similar job (but not the same) but i can't modify it correctly:
Private Sub Worksheet_Change(ByVal Target As Range) Dim LastRow As Long Dim Pos As Long Dim i As Long With ActiveSheet LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row For i = 1 To LastRow Pos = InStrRev(.Cells(i, "A").Value, "-") If Pos > 0 Then .Cells(i, "A").Value = Left(.Cells(i, "A").Value, Pos - 1) End If Next i End With End Sub
Thanks in anticipation.