mbmc.net
当前位置:首页 >> vBA 下拉框 >>

vBA 下拉框

Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$G$13" Then Select Case Target.Value Ca...

在窗体上拖一个复合框,粘贴如下初始代码: Private Sub UserForm_Initialize() ComboBox1.List = Array(".jpg", ".gif", ".bmp") End Sub 运行效果如图所示。

Private Sub Form_Load()With Combo1 .AddItem ("1") .AddItem ("2") .AddItem ("3")End WithDim A As ByteA = Combo1.TextMsgBox AEnd Sub

Private Sub UserForm_Initialize() ComboBox1.AddItem "sheet1" ComboBox1.AddItem "sheet2" ComboBox1.AddItem "sheet3" End Sub 你是个聪明人!!真的.(至少比我聪明,呵)

Dim Rng As Range Set Rng = range("A1") With Rng.Validation .Delete .Add Type:=xlValidateList, Formula1:="=$C$4:$C$7" End With Set Rng = Nothing

插入组合框ComboBox 添加代码 ComboBox1.AddItem "星期一" ComboBox1.AddItem "星期二" ComboBox1.AddItem "星期三" ComboBox1.AddItem "星期四" ComboBox1.AddItem "星期五" ComboBox1.AddItem "星期六" ComboBox1.AddItem "星期日"

Private Sub UserForm_Initialize() Me.ComboBox1.AddItem "生产部" Me.ComboBox1.AddItem "维修部" End Sub 或 Private Sub UserForm_Initialize() Me.ComboBox1.List = Array("abc", "CDE") End Sub

你可以循环将字符串连接起来,再赋值给 formula1 嘛 实在要单条加入的话,看下面我写的一个例子(实质还是拼接): Sub test(rg As Range, str1 As String)If InStr(rg.SpecialCells(xlCellTypeAllValidation).Address, rg.Address) = 0 Then rg...

Dim arr Private Sub ComboBox1_Change() ComboBox1.DropDown a = ComboBox1.Text For i = ComboBox1.ListCount - 1 To 0 Step -1 If InStr(ComboBox1.List(i), a) = 0 Then ComboBox1.RemoveItem (i) End If Next If a = "" Then ComboBox1.Vis...

1.打开Excel2007,首先输入下拉列表项内容,同时选中该组内容,在“名称框”输入名称来为该组命名,如图: 2.接下来,切换至“数据”选项卡,点击“数据有效性”项。 3.在打开的“数据有效性”窗口中,从“允许”下拉列表中选择“序列”,然后在“来源”输入框...

网站首页 | 网站地图
All rights reserved Powered by www.mbmc.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com