Excel精英培训网

 找回密码
 注册
数据透视表40+个常用小技巧,让你一次学会!
查看: 1664|回复: 3

[已解决]新人求助:简单的系统

[复制链接]
发表于 2012-11-5 14:01 | 显示全部楼层 |阅读模式
内容在时面,请高手帮忙
最佳答案
2012-11-5 14:21
不需要用拼音了,直接用动态数据有效性选择即可。
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2. If Target.Address <> "$B$3:$E$3" Then Exit Sub
  3. Dim Arr, i&
  4. Set d = CreateObject("Scripting.Dictionary")
  5. Arr = Sheet2.[a1].CurrentRegion
  6. For i = 2 To UBound(Arr)
  7.     d(Arr(i, 2)) = i
  8. Next
  9. t = d.items
  10. With Target.Validation
  11.     .Delete
  12.     .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
  13.         Operator:=xlBetween, Formula1:=Join(d.keys, ",")
  14. End With
  15. End Sub
复制代码

简单的系统.rar

72.31 KB, 下载次数: 6

excel精英培训的微信平台,每天都会发送excel学习教程和资料。扫一扫明天就可以收到新教程
发表于 2012-11-5 14:21 | 显示全部楼层    本楼为最佳答案   
不需要用拼音了,直接用动态数据有效性选择即可。
  1. Private Sub Worksheet_SelectionChange(ByVal Target As Range)
  2. If Target.Address <> "$B$3:$E$3" Then Exit Sub
  3. Dim Arr, i&
  4. Set d = CreateObject("Scripting.Dictionary")
  5. Arr = Sheet2.[a1].CurrentRegion
  6. For i = 2 To UBound(Arr)
  7.     d(Arr(i, 2)) = i
  8. Next
  9. t = d.items
  10. With Target.Validation
  11.     .Delete
  12.     .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, _
  13.         Operator:=xlBetween, Formula1:=Join(d.keys, ",")
  14. End With
  15. End Sub
复制代码

简单的系统1105.rar

80.91 KB, 下载次数: 16

回复

使用道具 举报

 楼主| 发表于 2012-11-5 14:40 | 显示全部楼层
回复

使用道具 举报

 楼主| 发表于 2012-11-5 14:58 | 显示全部楼层
不过最好还是请老大们把程序编全了,我现在的级别还达不到独立完成这个作业的水平
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|Excel精英培训 ( 豫ICP备11015029号 )

GMT+8, 2024-5-19 21:03 , Processed in 0.299598 second(s), 15 queries , Gzip On, Yac On.

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表