When I click CommandButton1 in UserFrom1, I put 10 in variable A (variable A is public variable). What code would it be to display UserFrom2 in UserFrom2.Show and MsgBox in UserFrom2 to display the contents of variable A?
Currently, the program in UserFrom2 says MsgBox UserFrom1.A, but 10 is not displayed.
vba
I don't know when to call UserFrom2, but
When I tried using this code, I pressed the UserFrom2 button to see the value in UserFrom1.A.
UserFrom1
Option Explicit
Public As String
Private Sub CommandButton1_Click()
A = 10
UserFrom 2.Show
End Sub
UserFrom 2
Option Explicit
Private Sub CommandButton1_Click()
MsgBox UserFrom 1.A
End Sub
© 2024 OneMinuteCode. All rights reserved.