I am writing a macro in Excel where I need to get a substring from a String. It\'s like this.
~/tester/test/hai/bye ~/stack/overflow/hai/bye
Try this:
Sub Macro1() Dim text As String, result As String text = "~/tester/test/hai/bye" result = Mid(text, 3, InStr(3, text, "/") - 3) 'MsgBox is for demo only MsgBox result End Sub