1:如何通过Excel设置数据级联(包括一级级联、二级级联以及多级级联)
我希望填写者能够按照固定的模式填写性别、省、市,而且市这一列填写内容必须随着省这一列发生动态改变。
Step1: 在当前excel中新建一个sheet,依次填写对应列的固定模式(此处性别这一列对应的固定模式为男/女,省这一列对应的固定模式为四川省/广西省,四川省对应的市有成都/眉山,广西省对应的市有河池/北海),通过ctrl+F3设置每一行的名称
Step2:设置目标列的数据有效性,如果当前为一级级联,如省这一列,设置数据有效性的来源为(=省份,此处的省份就是在step1中设置的名称);如果当前列为二级级联,如市这一列,则设置数据有效性的来源为(=INDIRECT($C2)
,此处的$C2
就是指省这一列)
通过POI设置Excel级联导出
最新推荐文章于 2024-07-15 10:37:03 发布
本文介绍了如何通过Excel设置数据级联,包括一级、二级及多级,详细阐述了从手动设置到代码实现的过程。首先在Excel中新建sheet并设置固定模式,然后设置数据有效性以实现级联效果。接着,通过Apache POI库在Java代码中创建Workbook并设置级联数据有效性。最后,探讨了如何实现选择更改时自动清除子级联相关数据的方法,涉及VBA宏代码的应用。
摘要由CSDN通过智能技术生成