【发布时间】:2010-07-22 08:17:07
【问题描述】:
我有一个电子表格,一个部门会将样本扫描到其中,当它被扫描(发送)时,它会在旁边的列中添加时间和日期戳。然后下一个部门将样本扫描到另一列,并在扫描(接收)时标记时间和日期。我使用的代码如下,但由于保护,我不能让两个人同时编辑电子表格。有什么我可以做的吗?
Private Sub Worksheet_Change(ByVal Target As Range)
ActiveSheet.Protect ("Password"), UserInterfaceOnly:=True
'Only write a timestamp of an odd column changes (because the timestamps go in the even columns)
If Target.Column Mod 2 > 0 Then
'Get the first part of the address, to get the actual column being changed
Dim columnAddress As String
columnAddress = Target.Address
If InStr(columnAddress, ":") > 0 Then
columnAddress = Left(columnAddress, InStr(columnAddress, ":") - 1)
End If
If Not ActiveSheet.Range(columnAddress).Formula = "" Then
'Write the timestamp for the previous column
ActiveSheet.Range(columnAddress).Offset(0, 1).Formula = Now
Else
ActiveSheet.Range(columnAddress).Offset(0, 1).Formula = ""
End If
End If
End Sub
【问题讨论】:
-
为什么要使用电子表格来完成数据库工作?
-
正在建立数据库,这是一个创可贴。