1
votes

I have one UserForm with 1 TextBox and 1 ComboBox.

I firstly write in the ComboBox (per exemple Sarah)

Private Sub ComboBox1_Change()
ThisWorkbook.Sheets("CalculSheet").Range("A2").Value = ComboBox1.Text
End Sub

Then it makes some calcul in A3 like (If D2=Sarah Then D3=1)

Private Sub UserForm_Active()

Application.ScreenUpdating = False
ThisWorkbook.Worksheets("CalculSheet").Activate
TextBox1 = Range("A3").Value

End Sub

And I want that the Result comes directly in my TextBox1. It means that I write Sarah in the ComboBox1 and directly comes 1 in the TextBox1.

1
there isn't any event called Active. You could find and possibly use Activate eventKazimierz Jawor
Sorry, it's activate, but doesn't work too((Chris

1 Answers

0
votes

Delete the Private Sub UserForm_Active() code. You don't need that. Replace ComboBox1_Change() with this.

Is this what you are trying? (Untested)

Private Sub ComboBox1_Change()
    With ThisWorkbook.Sheets("CalculSheet")
        .Range("A2").Value = ComboBox1.Text
        DoEvents
        TextBox1.Text = .Range("A3").Value
    End With
End Sub