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. form表单提交前进行ajax或js验证,校验不通过不提交
  2. 点云python-pcl
  3. SpringCloud 应用在 Kubernetes 上的最佳实践 — 部署篇(工具部署)
  4. Java笔记 —— 继承
  5. Windows server 2003 下载
  6. cass有坐标文件生成里程文件_请问在CASS7.0中怎样生成坐标文件和里程文件,请尽量详细...
  7. 光纤猫可做无线打印服务器吗,光猫自带的天线,这些天线都有什么用呢?是无线功能吗?...
  8. 第二次打卡 数据处理
  9. 027. 从从门槛和可复制性聊聊生意模式
  10. Nebula Graph - SpringBoot 操作 Nebula
  11. java短信登录_JAVA短信验证登录
  12. 溯源系统服务器,区块链溯源服务平台系统架构!
  13. 解鞍卸甲——手写简易版Spring框架(终):使用三级缓存解决循环依赖问题
  14. 2.Lambda表达式
  15. easycode 表配置信息不正确
  16. 如何直接运行.pyc文件?
  17. 学计算机女生网名,女生网名大全好听唯美的
  18. 美版头条BuzzFeed两天股价涨3倍:因采用ChatGPT上岗写稿
  19. CleanMyMac X4.8许可证Crack Keygen
  20. Activiti 流程执行

热门文章

  1. Python接口测试实战2 - 使用Python发送请求
  2. 09-02 电影模块实现 电影搜索-电影详情
  3. 04-nginx静态资源部署实战
  4. 邻接矩阵的深度遍历和深度遍历
  5. 3.12 小红书评论和私信时要注意什么?【玩赚小红书】
  6. PHP资产管理系统源码可自由设计资产卡片
  7. 2021年化工自动化控制仪表考试题及化工自动化控制仪表证考试
  8. 微信小程序开发实战课程之油耗计算器-耿广龙-专题视频课程
  9. iOS如何查看静态库.a文件是否支持i386?
  10. 最新席瓦莱恩服务器人口比例,魔兽世界怀旧服人口普查最新2021数据 WOW怀旧服人口普查3月最新数据报告[多图]...