Question: I want to allow the user to make a selection, run some code, pause for another selection, run more code?

I work with documents with large number of tables that eventually convert to HTML. Sometimes the formatting on two like tables doesn't convert the same. Knowing how the converter works, I'd like to copy all of the formatting data from one table and "paste" it onto another one.

I've the idea of a userform to have the user select something, hit a copy button, select something else and hit a paste button.

Answer: 
You can use global a global variable:

```
Public myVar as Variant

Sub fillmyVar()
    myVar = Selection
End Sub

Sub doSth()
    ' use myVar and the new selected text
End Sub

```
Using the answer from Aaron and incorporating it with a ToggleButton in the Userform you can successfully pause the code. With this you can then work in an additional selection to change the operation.

I originally did not use Global or Public Variables but soon learnt that its easier for passing data between `Subs` and `Userforms`

Userform:

```
Public Sub ToggleButton1_AfterUpdate()

    'Program is Paused / Selected to Pause

    If ProgBar.ToggleButton1.Value = True Then
        'Changing the Text of the Toggle button once the program is selected to Pause
        'If program paused then button will display continue
        ProgBar.ToggleButton1.Caption = "Continue"

        'For Sending to  Loop Code
        ProgramStatus = "0"
        Call LoopCode.PrgStat(ProgramStatus)

    End If

    'Program is running / Selected to run

    If ProgBar.ToggleButton1.Value = False Then
        'Changing the Text of the Toggle button once the program is selected to continue
        'If program running then button will display pause
        ProgBar.ToggleButton1.Caption = "Pause"

        'For Sending to  Loop Code
        ProgramStatus = "1"
        Call LoopCode.PrgStat(ProgramStatus)

    End If

End Sub

```

In your Module

```
Public Status As String

Public Sub PrgStat(ByVal ProgStatus As String)

   Status = ProgStatus

End Sub

Sub SomeSub()

 Do While

   ' Some Loop Code Running

          If Status = "1" Then

          'Toggle Not Pressed           

          End If

          If Status = "0" Then

             'Toggle Button Pressed

             Do While Status = "0"
                'Program will stop here until the togglebutton on the 
                'userform is pressed again which changes Status = 1

                'This is where you can make another selection on the 
                'userform

                 DoEvents

             Loop

          End If

   Loop
 End Sub

```