我创造了,
SpinButton1用于年 , SpinButton2用于月来自SpinButton1的
TextBox1和来自SpinButton2
的TextBox2
SpinButton1中的“ E2 ”和SpinButton2中的“ F2 ” 。
当我将“E2”更改为 yyyy 格式时,它会将值从2022 “F2”更改为mmm或mm格式的1905,它不会改变任何内容。
如何将“ G2 ”创建为yyyy-mm或yyyy-mmm格式?
Private Sub SpinButton1_Change()
SpinButton1.Max = 2030
SpinButton1.Min = 2021
SpinButton1.SmallChange = 1
TextBox1.Value = SpinButton1.Value
End Sub
Private Sub SpinButton2_Change()
Dim Mths As Variant
SpinButton2.Max = 11
SpinButton2.Min = 0
Mths = Array("Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec")
TextBox2.Text = Mths(SpinButton2.Value)
End Sub
Private Sub TextBox1_Change()
ActiveSheet.Range("E2") = SpinButton1.Value
End Sub
Private Sub TextBox2_Change()
ActiveSheet.Range("F2") = TextBox2.Text
End Sub