Sub BeforeCounterslash() Dim StrPath As String StrPath = "C:\Sub_1\Sub_2\Sub_3" StrPath = left(StrPath, InStrRev(StrPath, "\") - 1) MsgBox StrPath End Sub