我很难让我的Excel-VBA代码正常工作。我希望在将文本输入单元格后弹出一个按钮。在这里,Yes导致行被锁定而另一个单元格被加上时间戳,但是我希望取消导致我输入文本的单元格被清除内容。
我无法找到删除最近条目的方法。我可以删除ActiveCell,但这不是最近的单元格(比如你在A1中写文字然后按回车键,活动单元格将是A2 - 或者如果你写文本然后用光标按某处,那么活动单元格将会天知道是什么意思。
我希望有人能帮助我。
祝你好运
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then
Application.EnableEvents = False
Dim Ret_type As Integer
Dim strMsg As String
Dim strTitle As String
strMsg = "Do you approve?" & vbCrLf & "Warning: This action will lock the current row."
strTitle = "Approval"
Ret_type = MsgBox(strMsg, vbYesNo + vbQuestion, strTitle)
Select Case Ret_type
Case 7
MsgBox "Your input will be deleted."
Exit Sub
Case 6
Cells(Target.Row, 3).Value = Date + Time
Application.EnableEvents = True
ActiveSheet.Unprotect Password:="password"
Target.EntireRow.Locked = True
ActiveSheet.Protect Password:="password"
Application.EnableEvents = True
End Select
End If
End Sub
答案 0 :(得分:0)
尝试使用以下代码
Graph graph = new Graph();
graph.getNodeTable().addColumn("duration", double.class);
Node n1 = graph.addNode();
n1.setDouble("duration", 20.0);
Node n2 = graph.addNode();
Edge e = graph.addEdge(n1, n2);