使用Excel JavaScript API从Excel工作表中查找脏的(已编辑的)单元格 [英] Find the dirty(edited) cell/cells from excel sheet using Excel JavaScript API
问题描述
我正在在线使用Office 365和Excel(内部版本16.0.9403.1875).
I am using office 365 and Excel online (Build 16.0.9403.1875).
,并且我正在使用 Excel javascript API创建Microsoft Excel在线加载项.
如何使用Excel Javascript API 从Excel工作表中找到一个或多个脏单元格.
How to find the dirty cell/cells from excel sheet using Excel Javascript API.
如果按值/公式/格式编辑单元格,则该单元格变得脏了.因此,我需要从单元格范围中找出所有单元格是脏的(已编辑).
If a cell is edited by value / formula / format, that became dirty. So I need to find, what are all the cells are dirty(edited) from range of cells.
作为参考,请找到
计算
此链接中的方法.
提前谢谢.
推荐答案
由于Excel本身没有脏标志,因此您需要通过以下两种方法之一来生成一个:
Since Excel doesn't natively have a dirty flag, you'll need to produce one via one of two methods:
捕获单元格编辑事件并记录已编辑的脏单元格列表.
Catch the cell edit event and record a list of edited cells that are dirty.
Dim Dirty As New Collection
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim sheet As Worksheet
Set sheet = Sh
Dirty.Add (sheet.Name + "!" + Target.Address)
End Sub
OR
当需要脏标志时,请在后台打开保存的副本,并比较两者以查看发生了什么变化.
When you need the dirty flag, open the saved copy behind the scenes and compare the two to see what has changed.
这篇关于使用Excel JavaScript API从Excel工作表中查找脏的(已编辑的)单元格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!