我有一个带有初始化事件的用户表单,如下所示:
Public CurrSpanNum, CurrSegNum As Integer
Private Sub UserForm_Initialize()
CurrSegNum = Sheets("UserData").Range("C2").value
Debug.Print "SegForm, SpanNum = " & CurrSpanNum
CurrSpanNum = Sheets("UserData").Range("D2").value
Debug.Print "SegForm, SegNum = " & CurrSegNum
End Sub
在即时窗口中,我看到:
SegForm, SpanNum =
SegForm, SegNum = 3
在初始化表单之前,值 3 被放置在两个单元格中。为什么我似乎无法加载 SpanNum 而 SegNum 能够加载?