Global Variable in Userform

冷暖自知 提交于 2019-12-06 15:14:31

As I said in my comment, that your method should work. Here is the test code that I tried

1- In Module1

Public Word As String

2- Create 2 user forms - UserForm1 and UserForm2

2a- In UserForm1

Private Sub UserForm_Activate()
    Word = "This is Saturday"
End Sub

2b- In UserForm2

Private Sub UserForm_Activate()
    Label1.Caption = Word
End Sub

3- Then in ThisWorkbook

Private Sub Workbook_Open()
    UserForm1.Show
    UserForm2.Show
End Sub

So when you close UserForm1, the UserForm2 would be displayed as below

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!