excel下拉菜单vba

With Excel's data validation, you can show a drop down list of items in a cell. You can even create "dependent" drop downs. For example, select a region, and see only the customers in that region. See how to show a warning in Excel drop down list, if the source data is not set up correctly.

使用Excel的数据验证,您可以在单元格中显示项目的下拉列表。 您甚至可以创建“从属”下拉列表。 例如,选择一个区域,然后仅查看该区域中的客户。 如果源数据设置不正确,请参见如何在Excel下拉列表中显示警告。

从属下拉列表 (Dependent Drop Down Lists)

In this example, select a region name in column B. Then, when you click the drop down arrow in column C, the list just shows the customers in that region.

在此示例中,在B列中选择一个区域名称。然后,当您单击C列中的下拉箭头时,列表仅显示该区域中的客户。

There are a couple of benefits to dependent drop down lists:

依赖下拉列表有几个好处:

  • It's easier to pick a customer from a short list, instead of the full list从短列表而不是完整列表中选择客户比较容易
  • It encourages valid customer entries. (Data validation isn't bulletproof – there are ways to get around it)它鼓励有效的客户输入。 (数据验证不是防弹的,有很多方法可以解决)

Get the sample file, and see the complete setup instructions on my website.

获取示例文件,并在我的网站上查看完整的安装说明 。

名单 (The Lists)

There are two lists used in this dependent data validation technique.

在此依赖数据验证技术中使用了两个列表。

  • The Region drop down is based on the Regions list.区域下拉列表基于“区域”列表。
  • The Customer drop down shows the customers for the selected region, from the Region/Customer table“客户”下拉列表从“地区/客户”表中显示所选地区的客户

客户下拉 (Customer Drop Down)

The dependent drop down for Customer  uses OFFSET, MATCH and COUNTIF to find the customers for the selected region.

客户的从属下拉列表使用OFFSET,MATCH和COUNTIF查找所选区域的客户。

  • =OFFSET(RegionStart, MATCH(B2,RegionColumn,0)-1, 1, COUNTIF(RegionColumn,B2),1)

    = OFFSET(RegionStart,MATCH(B2,RegionColumn,0)-1,1,COUNTIF(RegionColumn,B2),1)

It finds the first instance of the region name, and gets customers from the next column, based on a count of the region name. In this screen shot, East is in the 8th row, and the six customers from that region would appear in the drop down.

它查找区域名称的第一个实例,并根据区域名称的计数从下一列获取客户。 在此屏幕快照中,East在第8行,该区域的六个客户将出现在下拉列表中。

See my website, for more details on how the formula works.

有关该公式如何工作的更多详细信息,请参见我的网站。

按地区排序 (Sort By Region)

For the OFFSET formula to work correctly, the lookup table MUST be sorted by the Region column. If the list is sorted by customer name, the East region list would show the wrong set of 6 names.

为了使OFFSET公式正常工作,必须按Region列对查找表进行排序。 如果该列表按客户名称排序,则东部地区列表将显示错误的6个名称集。

检查区域是否已排序 (Check if the Regions Are Sorted)

In the original version of this technique, you had to remember to sort the list by region, after making any changes to the lookup list. There wasn't a warning system to alert you to problems.

在此技术的原始版本中,您必须记住在对查找列表进行任何更改之后,按区域对列表进行排序。 没有警告系统可以提醒您问题。

To help avoid errors, I've created a new sample file, and it has formulas to check if the region names are in A-Z order.

为了避免发生错误,我创建了一个新的示例文件,该文件具有用于检查区域名称是否按AZ顺序排列的公式。

There's a new column (SortCheck) in the lookup table, with a formula to check the order.

查找表中有一个新列(SortCheck),其中包含用于检查顺序的公式。

  • =IF(A3="",0,--(A3<A2))

    = IF(A3 =“”,0,-(A3 <A2))

If an item is out of order, there is a 1 in the row above it. The "East" in A5 is less than the "West" in A4, so cell C4 returns a 1, instead of a zero.

如果某件商品出现故障,则该商品上方的行中有1。 A5中的“东部”小于A4中的“西部”,因此单元格C4返回1,而不是零。

获取总数 (Get the Total Number)

In a cell named SortCheck, a formula calculates the total for that SortCheck column.

在名为SortCheck的单元格中,公式将计算该SortCheck列的总数。

  • =SUM(tblRegCust[SortCheck])

    = SUM(tblRegCust [SortCheck])

Another named cell, SortMsg, contains a typed error message that will be used in the data validation.

另一个命名单元SortMsg包含将在数据验证中使用的类型化错误消息。

在Excel下拉菜单中显示警告 (Show Warning in Excel Drop Down)

To show a warning in Excel drop down when necessary, I changed the Customer data validation formula slightly. The IF function looks at the total, and shows the SortMsg range, if the total is greater than zero.

为了在必要时在Excel下拉菜单中显示警告,我略微更改了客户数据验证公式。 如果总数大于零,则IF函数查看总数,并显示SortMsg范围。

  • =IF(SortCheck>0, SortMsg, OFFSET(RegionStart,MATCH(B2,RegionColumn,0)-1, 1, COUNTIF(RegionColumn,B2),1))

    = IF(SortCheck> 0,SortMsg, OFFSET(RegionStart,MATCH(B2,RegionColumn,0)-1,1,COUNTIF(RegionColumn,B2),1)))

You'll have to fix the list, before you can choose a customer name.

您必须先修正列表,然后才能选择客户名称。

It's easy to overlook a message that's in a worksheet cell, but this error message is hard to ignore!

忽略工作表单元格中的消息很容易,但是很难忽略该错误消息!

其他相关方法 (Other Dependent Methods)

For other ways to create dependent drop down lists, go to the following pages on my Contextures site:

有关创建依赖下拉列表的其他方法,请转到Contextures网站上的以下页面:

  • Create Dependent Drop Down Lists with INDIRECT

    使用INDIRECT创建从属下拉列表

  • Dependent Lists With INDEX

    INDEX的从属列表

获取样本文件 (Get the Sample File)

Get the warning in Excel drop down sample file, and see the complete instructions on my website.

在Excel下拉示例文件中获得警告 ,并在我的网站上查看完整说明。

翻译自: https://contexturesblog.com/archives/2018/02/08/show-warning-in-excel-drop-down/

excel下拉菜单vba


http://www.taodudu.cc/news/show-5534468.html

相关文章:

  • C++学习(一一一)regsvr32命令的原理
  • win7 64位系统运行regsvr32.exe注册32位模块提示版本不兼容的解决方法
  • C++ Regsvr32命令详解
  • 说说regsvr32命令
  • regsvr32注册DLL注意
  • regsvr32的用法
  • regsvr32命令集锦
  • Regsvr32命令修复系统故障实例
  • regsvr32
  • Android之adb删除应用
  • Linux下安装mysql以及配置用户与数据导入
  • 检查SIM卡当前环境是否支持2G/3G/4G/5G
  • 红米note2移动4g在哪里显示无服务器,红米Note2支持4G吗?红米Note2支持4G网络吗?...
  • 手机鸿蒙系统4g手机可以用吗,华为上架搭载鸿蒙系统的新机,但无奈只能是4G...
  • 4g android 手机排行榜,安卓手机3月好评榜发布,华为旗舰排名第二,只有3款4G机型!...
  • 华为m3现在还能用吗_华为m3怎么样 值得买吗【图文】
  • 小米3S或采用5.5寸1080p屏 配3G内存支持4G
  • 鸿蒙系统4g以上,华为四款手机发布:预装鸿蒙系统,全部支持4G!
  • 小米3支持 4G网络吗
  • 超全面 pandas 数据预处理+数据概览 处理技巧整理(持续更新版)
  • JavaWeb 2022.9.24
  • JavaWeb基础入门到上手项目
  • 测试必要会的接口测试,不一样的接口测试学完就能涨薪3k。
  • 第十九节 HTTP 协议
  • 102.【Redis】
  • javaweb学习,快速入门
  • 狂神Javaweb完整版基础入门(IDEA版)值得学习的JavaWeb教程
  • 【转载】JAVA知识点集锦(中)
  • 从零开始使用深度学习训练一个新闻分类器(干货)
  • web编程项目--新闻网站搭建

excel下拉菜单vba_在Excel下拉菜单中显示警告相关推荐

  1. excel下拉菜单vba_在Excel下拉菜单中删除使用过的项目

    excel下拉菜单vba There is a new sample file on my Contextures web site, which lets you pick players for ...

  2. MF30:VBA_清除Excel缓存

    我给VBA的定义:VBA是个人小型自动化处理的有效工具.利用好了,可以大大提高自己的工作效率,而且可以提高数据的准确度.我的教程一共九套,分为初级.中级.高级三大部分.是对VBA的系统讲解,从简单的入 ...

  3. 如何让图片充满excel单元格_如何在Excel单元格建立下拉菜单

    对于一些常用的数据我们往往会希望能够尽量快速的输入,下拉菜单就是一个最简单的解决办法.那么如何实现下拉菜单呢?跟随以下步骤,建立属于自己的下拉菜单吧! 如何建立下拉菜单? 一.确定内容:在单元格中,输 ...

  4. 选下拉框的的值对应上传相应的图片_如何在excel中实现,选择下拉菜单某一项,该表格中就出现选项对应的数据?(excel表格制作选择数据)...

    怎样从多个excel表格中提取数据,做数据分析图呢 1. 数据的.录入.表格的设置,效果如示. 2.如图所示,选进行分析的图据范围 3.如图所示,点击菜单栏目上的"插入",选择&q ...

  5. 选下拉框的的值对应上传相应的图片_excel表格下拉菜单调用对应数据,如何在excel中实现,选择下拉菜单某一项,该表格中就出现选项对应的数据?...

    如何在excel中实现,选择下拉菜单某一项,该表格中就出现选项对应的数据? 选中这几列 打开菜单"数据"-"筛选"-"自动筛选"就是了. 另 ...

  6. php excel多级下拉菜单自动匹配,Excel下拉菜单怎么做 多级联动+自动匹配教程

    Excel一直是近年来办公室工作中的必要软件之一,这个软件功能非常强大,如果你只学会了皮毛那就有些可惜了,而Excel隐藏了许多许多的小技巧.今天UU为大家带来的是Excel下拉菜单怎么做,其中包括多 ...

  7. 视频教程-Excel下拉菜单怎么做 Excel排序高手技巧视频教程-Office/WPS

    Excel下拉菜单怎么做 Excel排序高手技巧视频教程 本人张光欢,在2018年4月1日注册公司邢台水滴计算机科技有限公司,从事于计算机软硬件开发,信息技术咨询服务 张光欢 ¥39.00 立即订阅 ...

  8. html 联想下拉菜单,excel下拉菜单联想 在Excel中制作具有联想能力的下拉列表的方法...

    excel下拉菜单联想 在Excel中制作具有联想能力的下拉列表的方法,看到标题你是不是很兴奋,这不就是你想学习的知识吗?当你掌握excel下拉菜单联想这个知识的时候你一定很兴奋,一定不会后悔看了ex ...

  9. excel实用技巧:如何构建多级下拉菜单

    使用数据有效性制作下拉菜单对大多数小伙伴来说都不陌生,但说到二级和三级下拉菜单大家可能就不是那么熟悉了. 什么是二级和三级下拉菜单呢?举个例子,在一个单元格选择某个省后,第二个单元格选项只能出现该省份 ...

最新文章

  1. SQL Server基础知识之:设计和实现视图
  2. C#设计模式之享元模式(Flyweight)
  3. 优秀简历要遵循哪些规则
  4. PHP对请求时间范围条件的判断
  5. P3690-[模板]Link Cut Tree(动态树)【Splay】
  6. NOIP 2015 提高组 Day2
  7. 计算机等级考试二级Python讲座(二)
  8. 每天定时自动优化MySQL数据库
  9. Selenium自动化测试-8.iframe处理
  10. ssm游文化推广系统答辩PPT模板
  11. 2020 年百度之星·程序设计大赛 - 初赛一 Drink
  12. 奥卡姆剃刀定律(Occam's Razor, Ockham's Razor)
  13. UVA 1252 十五 Twenty Questions
  14. 基于ueditor 扩展的电子病历编辑器
  15. 分享!基于新浪API生成短链接的15个最佳平台
  16. 3、RDD-Single-Stage Rotation-Decoupled Detector for Oriented Object
  17. (一)、写一个怪物的类,类中有属性姓名(name),攻击力(attack),有打人的方法(fight)。(方法的重写)...
  18. merlin 实现中文语音合成基础知识和常见问题汇总
  19. 四个小问题,简单解释一下 tomcat 和servlet 的关系
  20. 【codechef】Children Trips

热门文章

  1. 《2021爱智先行者—初体验-图文解析精灵1号边缘计算机的安装与调试、启动自带的WiFi路由器功能、编写安装一个计算器小程序》
  2. HTC FOCUS3在PC端串流FOHEART H1数据手套(腕带)
  3. 苹果x微信语音十秒就断_苹果解释iPhone 12设计初衷;微信回应语音进度条功能...
  4. 高企认定对研发费用的要求是什么?
  5. uniAPP实现单页面横竖屏切换
  6. idea连接mysql数据库8.0,大厂直通车!
  7. IDEA快捷键超好看桌面壁纸
  8. iPhone 系列壁纸,太好看了!
  9. 缓存更新策略概览(Caching Strategies Overview)
  10. 学好C语言需要的五本书