Excel中用VBA函数进行颜色筛选的操作方法
时间:2022-04-27 04:12:57
在excel中,使用可视化的简单操作方法,是很难根据颜色来筛选的,因此,我们只能使用VBA代码来实现。今天,小编就教大家在Excel中用VBA函数进行颜色筛选的操作技巧。
Excel中用VBA函数进行颜色筛选的操作步骤:
以下代码的功能是:除首行外,将当前单元格所在列数据与当前单元格不同颜色的行隐藏起来,数据首行为标题列。
如果你有其它的需求,请自行修改代码。
Sub FilterColor()
Dim UseRow, AC
UseRow = Cells.SpecialCells(xlCellTypeLastCell).Row
If ActiveCell.Row > UseRow Then
MsgBox "超出范围,请选择有数据或有意思的单元格!", vbExclamation, "错误"
Else
AC = ActiveCell.Column
Cells.EntireRow.Hidden = False
For i = 2 To UseRow
If Cells(i, AC).Interior.ColorIndex <> ActiveCell.Interior.ColorIndex Then
Cells(i, AC).EntireRow.Hidden = True
End If
Next
End If
End Sub
Excel中用VBA函数进行颜色筛选的操作方法
标签:中用,函数,筛选,颜色,Excel函数
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
excel计算复合运算的方法
2022-05-18 06:37:16
如何保护excel工作表
2023-10-04 03:45:52
![](https://img.aspxhome.com/file/2023/9/a154369_0s.png)
excel 换行快捷键是什么
2023-07-12 22:15:31
![](https://img.aspxhome.com/file/2023/7/a155367_0s.gif)
Office提示操作系统当前配置不能运行怎么办?
2023-10-16 10:59:40
![](https://img.aspxhome.com/file/2023/9/16029_0s.jpg)
Excel 2013表格中根据销售日期算出月份交易总金额
2022-09-12 04:31:52
![](https://img.aspxhome.com/file/2023/3/38193_0s.jpg)
Excel2013中对不并列的数据进行排名
2022-12-19 03:11:51
![](https://img.aspxhome.com/file/2023/3/38043_0s.jpg)
Word中怎么将繁体字转化为简体字
2022-09-07 17:40:42
![](https://img.aspxhome.com/file/2023/4/21934_0s.jpg)
word如何在SmartArt图形中添加形状
2023-03-31 19:49:47
![](https://img.aspxhome.com/file/2023/1/32821_0s.jpg)
word 快速搞定编号和多级编号实现教程
2023-08-27 12:17:02
![](https://img.aspxhome.com/file/2023/7/33447_0s.gif)
excel表格数据精度设置的教程
2022-09-04 16:39:44
excel绘制函数图的教程
2022-10-13 23:21:07
excel表格强行换行的教程
2023-10-23 01:12:49
如何把电脑上的Word文档和Excel工作表传到手机上去并在手机打开
2023-11-29 07:34:13
![](https://img.aspxhome.com/file/2023/2/18442_0s.png)
Excel中trim函数用法和技巧
2022-07-14 14:38:15
Win10提示0x80070002无法上网怎么办?0x80070002处理方法
2023-11-16 07:55:58
![](https://img.aspxhome.com/file/2023/0/49360_0s.jpg)
Win10电脑怎么以管理员运行cmd命令?
2023-12-13 15:50:11
![](https://img.aspxhome.com/file/2023/0/50940_0s.jpg)
在新建名称的对话框中可以输入要设置的单元格名称
2022-06-16 05:37:48
关闭Office办公软件中自动拼写检查和自动语法检查图文教程
2023-01-22 10:59:41
![](https://img.aspxhome.com/file/2023/0/29190_0s.png)
if函数做判断,让你该剁手时就剁手
2022-09-18 11:42:44
![](https://img.aspxhome.com/file/2023/6/a157356_0s.gif)
excel怎么让选中的区域不可编辑?
2022-04-14 15:35:42