# Revision history [back]

### Event Macro on contents change

I have an excel sheet which tests a value in one column before it allows data to be entered in another (it is an accounting sheet which won't allow an amount to be entered unless there is a category set). I'm an experienced vba programmer but a newbie with LibreOffice macros. What is the easiest way to do this in Calc? I'm struggling to even find the correct event!!

vba code:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim a&
On Error GoTo errh

With Target
If .Column = 14 And Target.Value2 <> "" Then
If Cells(.Row, 12) = "" Then
Target.Value = ""
Cells(.Row, 12).Select
End If
End If
If .Column = 6 And Target.Value2 <> "" Then
If Cells(.Row, 3) = "" Then
Target.Value = ""
Cells(.Row, 3).Select
End If
End If
errh:
End With

End Sub


### Event Macro on contents change

I have an excel sheet which tests a value in one column before it allows data to be entered in another (it is an accounting sheet which won't allow an amount to be entered unless there is a category set). I'm an experienced vba programmer but a newbie with LibreOffice macros. What is the easiest way to do this in Calc? I'm struggling to even find the correct event!!

vba code:

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim a&
On Error GoTo errh

With Target
If .Column = 14 And Target.Value2 <> "" Then
If Cells(.Row, 12) = "" Then
Target.Value = ""
Cells(.Row, 12).Select
End If
End If
If .Column = 6 And Target.Value2 <> "" Then
If Cells(.Row, 3) = "" Then