更改单元格颜色,其中 vba 已更改值 VBA



我是 VBA 的新手,所以如果我听起来很愚蠢,请耐心等待我-

背景信息: 我正在尝试自动化我们每季度更新一次的工作簿 - 我想通过更改这些单元格的背景颜色来显示我的 VBA 脚本更改了哪些单元格,以便我可以在开发脚本时跟踪它们。它也适用于对VBA零知识的同事,他将查看数字并继续手动更新文件。

现在我注意到有一个我可以使用的事件过程:

Private Sub Worksheet_Change(ByVal Target As Range)
Target.Interior.Color = RGB(255, 253, 130)
End Sub

据我了解,即使更改是由 VBA 完成的,它也可以标记单元格,但我不知道如何使用我的 VBA 脚本实现它。我是否以某种方式将其插入到我的常规过程中,或者我是否必须将其嵌入到更新的目标文件中?

请注意,VBA 未写入目标文件中。由于客户端请求,该文件不能采用 xlsm 格式。

提前感谢!!

我会为此创建一个 Excel 加载项并将其安装到您的同事机器上。然后,根据您的要求将代码与客户端文件分开。

您可以使用.bat文件将其复制到他们的插件文件夹中。

REM
REM     /E   = Copies directories and subdirectories, including empty ones. Same as /S /E. May be used to modify /T. 
REM     /D:m-d-y = Copies files changed on or after the specified date. If no date is given, copies only those files whose source time is newer than the destination time. 
REM     /K   = Copies attributes. Normal Xcopy will reset read-only attributes. 
REM     /Q   = Does not display file names while copying. 
REM     /R   = Overwrites read-only files. 
REM     /Y   = Suppresses prompting to confirm you want to overwrite an existing destination file. 
REM
XCOPY ".YourAddin.xlam" "%AppData%MicrosoftAddInsYourAddin.xlam" /E /K /Q /R /Y /D

最新更新