[Solved] Copying a variable contained in cell into another cell


Try the code below, explanations inside the code’s comments:

Option Explicit

Sub ExtractAfterShowOnly()

Dim WordsArr() As String
Dim i As Long
Dim MatchString As String

' use Split to read each section between "https://stackoverflow.com/" as arra element
WordsArr = Split(Range("A2").Value2, "https://stackoverflow.com/")

' loop through array
For i = 1 To UBound(WordsArr)

    ' if there's a match, get the text inside and exit the loop
    If WordsArr(i) Like "*Show only:*" Then
        MatchString = WordsArr(i)
        Exit For
    End If
Next i

' Use Mid function to show the string after "Show only:"
MsgBox Mid(MatchString, Len("Show only:") + 1)

End Sub

solved Copying a variable contained in cell into another cell