I would do it differently, setup a form variable and pass the value to it as a property

Option Explicit

Private mcg1 As Double

Public Property Let g1(Value As Double)
    mcg1 = Value
End Property

Private Sub CommandButton1_Click()
    addr = Form2.RefEdit1.Value
    n1 = Form2.TextBox1.Value
    TextBox2 = mcg1
    'Unload Me
End Sub

Sub Sim()
Dim frm As Form2

    Set frm = Form2
    With frm
    
        .g1 = 5
        .Show
    End With
End Sub