Excel聚光灯加载宏【VBA】

2024-10-16 13:29:28

1、先看效果图,本聚光灯的效果是修改的单元格的背景样式,不会改变原有的底色和边框。

Excel聚光灯加载宏【VBA】

4、第二步:在左侧工程界面右击-添加-类模块

Excel聚光灯加载宏【VBA】

7、第五步:双击模块,复制如下代码到模块中Public lampcolor As VariantPublic B As VariantPubl足毂忍珩ic xlapp As New 类1Sub auto_open() Set xlapp.app = ApplicationEnd SubSub auto_close() Set xlapp.app = Nothing' Cells.Interior.ColorIndex = xlNone Cells.Interior.Pattern = xlPatternAutomaticEnd SubSub colorselection()On Error GoTo 10 A = ActiveWorkbook.Colors(1) Application.Dialogs(xlDialogEditColor).Show (1) B = ActiveWorkbook.Colors(1) ActiveWorkbook.Colors(1) = A10 ActiveWorkbook.ResetColorsEnd Sub

8、第六步:Excel 文件-另存为-加载宏文件地址就为默认地址就好,默认地址是一个隐藏文件夹,放在这里安全一些

Excel聚光灯加载宏【VBA】

10、第八步:开发工具-加载项-浏览,找到刚刚另存为的加载宏,确认!

Excel聚光灯加载宏【VBA】Excel聚光灯加载宏【VBA】
猜你喜欢