Sub CleanAttributeValue()
Dim rng As Range
Dim cell As Range
Dim cleanedText As String
Dim LastRow As Long
Dim startPos As Long
Dim endPos As Long
' Xac dinh dong cuoi cung trong cot("Attribute Value")
LastRow = ThisWorkbook.Sheets("Sheet").Cells(ThisWorkbook.Sheets("Sheet").Rows.Count, "O").End(xlUp).Row
Set rng = ThisWorkbook.Sheets("Sheet").Range("O2:O" & LastRow)
' Duy?t qua t?ng ô trong ph?m vi
For Each cell In rng
If Not IsEmpty(cell.Value) Then
' thay the ki tu " thanh inch"
cleanedText = Replace(cell.Value, """", "inch")
' Xóa giá tr? trong ngo?c
Do
startPos = InStr(cleanedText, "(")
endPos = InStr(cleanedText, ")")
If startPos > 0 And endPos > startPos Then
cleanedText = Left(cleanedText, startPos - 1) & Mid(cleanedText, endPos + 1)
Else
Exit Do
End If
Loop
' Loai bo khoang trang
cell.Value = Trim(cleanedText)
End If
Next cell
MsgBox "Done!"
End Sub