|
楼主 |
发表于 2022-3-21 19:44
|
显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
Sub Button4_Click()
Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "只有Production-C电脑才能更新,请确认是否是Production-C电脑?" '定义消息文本
Style = vbYesNo + vbCritical + vbDefaultButton2 ' 定义按钮
Title = "MsgBox Demonstration" ' 定义标题文本
Help = "DEMO.HLP" ' 定义帮助文件
Ctxt = 1000 ' 定义帮助主题
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
If Response = vbYes Then ' 用户按下“是”
MyString = "Yes" ' 完成某操作
GoTo 104
Else ' 用户按下“否”
MyString = "No" ' 完成某操作
GoTo 86
End If
104
Call Macro3
Call hqq
Call Macro4
UserForm1.Show
86
End Sub
Sub Button7_Click()
Call hqq
UserForm1.Show
End Sub
Sub Button8_Click()
Call hqq
UserForm2.Show
End Sub
Private Sub hqq()
Worksheets(2).Range("A2:J1048576").Interior.Color = RGB(255, 255, 255)
Dim s As New Collection, arr, rng As Range
Dim a As Integer
Dim i As Integer
a = Worksheets(5).[a65536].End(xlUp).Row
For Each rng In Worksheets(5).Range("A2:A" & a)
If rng <> "" Then s.Add rng, CStr(rng)
On Error Resume Next
Next
ReDim arr(1 To s.Count)
For i = 1 To s.Count
arr(i) = s(i)
Next
UserForm1.ComboBox2.List = arr
UserForm2.ComboBox3.List = arr
Dim s1 As New Collection, arr1, rng1 As Range
Dim a1 As Integer
Dim I1 As Integer
a1 = Worksheets(7).[c65536].End(xlUp).Row
For Each rng1 In Worksheets(7).Range("c3:c" & a1)
If rng1 <> "" Then s1.Add rng1, CStr(rng1)
Next
ReDim arr1(1 To s1.Count)
For I1 = 1 To s1.Count
arr1(I1) = s1(I1)
Next
UserForm2.ComboBox5.List = arr1
UserForm2.ComboBox7.List = arr1
UserForm2.ComboBox11.List = arr1
Dim s2 As New Collection, arr2, rng2 As Range
Dim a2 As Integer
Dim I2 As Integer
a2 = Worksheets(7).[e65536].End(xlUp).Row
For Each rng2 In Worksheets(7).Range("E3:E" & a2)
If rng2 <> "" Then s2.Add rng2, CStr(rng2)
Next
ReDim arr2(1 To s2.Count)
For I2 = 1 To s2.Count
arr2(I2) = s2(I2)
Next
UserForm2.ComboBox9.List = arr2
Dim s3 As New Collection, arr3, rng3 As Range
Dim a3 As Integer
Dim i3 As Integer
a3 = Worksheets(2).[e65536].End(xlUp).Row
For Each rng3 In Worksheets(2).Range("E3:E" & a3)
If rng3 <> "" Then s3.Add rng3, CStr(rng3)
Next
ReDim arr3(1 To s3.Count)
For i3 = 1 To s3.Count
arr3(i3) = s3(i3)
Next
UserForm2.ComboBox12.List = arr3
UserForm3.ComboBox14.List = arr3
UserForm1.ComboBox3.List = arr3 'add 8-Aug-16
today = Worksheets(1).Range("d5").Value
UserForm2.DTPicker1 = today
UserForm2.DTPicker2 = today
UserForm2.DTPicker3 = today
UserForm2.DTPicker4 = today
UserForm2.DTPicker5 = today
UserForm2.DTPicker6 = today
UserForm2.Frame3.Visible = False
UserForm2.Frame4.Visible = False
UserForm2.Frame5.Visible = False
UserForm2.Frame6.Visible = False
End Sub
|
|