|
本帖最后由 WANT-T 于 2022-11-8 16:32 编辑
把数据整合到一个表里,做个二级菜单的功能不就都有了?
向单元格添加列表的代码:
- Public Sub 向单元格添加列表(rng As Range, addlist As String)
- With rng.Validation
- .Delete
- .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Operator:=xlBetween, Formula1:=addlist
- .IgnoreBlank = True
- .InCellDropdown = True
- .InputTitle = ""
- .ErrorTitle = ""
- .InputMessage = ""
- .ErrorMessage = ""
- .IMEMode = xlIMEModeNoControl
- .ShowInput = True
- .ShowError = False
- End With
- End Sub
复制代码 一维数组转字符串:
- Public Function 一维数组转字符串(SourceArray, Optional Delimiter As String = ",") As String
- 一维数组转字符串 = Join(SourceArray, Delimiter)
- End Function
复制代码 利用ADO+SQL,查询数据,转成一维数组,然后就可以了用上面的代码了!
|
|