Sub Globals
'Declare the global variables here.
Dim Type(Column,Row,Value) UndoItem
End Sub
Sub App_Start
Form1.Show
FillTable
End Sub
Sub FillTable
Table1.AddCol(cString,"Col 1",50)
Table1.AddCol(cString,"Col 2",50)
Table1.AddCol(cString,"Col 3",50)
For i = 1 To 10
Table1.AddRow(i,i,i)
Next
End Sub
Sub AddItem (column,row,oldValue)
alStack.Insert(0,column & "," & row & "," & oldValue)
End Sub
Sub UndoLast
If alStack.Count = 0 Then Return 'No items
UndoItem() = StrSplit(alStack.Item(0),",")
alStack.RemoveAt(0)
Table1.Cell(UndoItem.Column,UndoItem.Row) = UndoItem.Value
End Sub
Sub btnChange_Click
col = Table1.SelectedCol
row = Table1.SelectedRow
AddItem(col,row,Table1.Cell(col,row)) 'Save the previous value
Table1.Cell(col,row) = txtChange.Text
End Sub
Sub btnUndo_Click
UndoLast
End Sub