I created a workseet in XP and I'm having to use it on a computer at work that only has W97. Can someone tell me what i have to do to this code to make it compatible?
It's failing at the ClearContents command.
Private Sub CommandButton1_Click()
Dim NextRow As Long
With Sheets("Data")
NextRow = .Cells(Rows.Count, 1).End(xlUp).Row + 1
'Column A (1) of next row
.Cells(NextRow, 1).Value = ComboEmployees.Value
'Column B (2) of next row
.Cells(NextRow, 2).Value = DateBox.Value
'Column C (3) of next row
.Cells(NextRow, 3).Value = VacBox.Value
'Column D (4) of next row
.Cells(NextRow, 4).Value = PDBox.Value
'Column E (5) of next row
If OB1.Value = True Then
.Cells(NextRow, 5).Value = 8
Else
.Cells(NextRow, 5).ClearContents
End If
'Column F (6) of next row
.Cells(NextRow, 6).Value = AbsentBox.Value
End With
End Sub
It's failing at the ClearContents command.
Private Sub CommandButton1_Click()
Dim NextRow As Long
With Sheets("Data")
NextRow = .Cells(Rows.Count, 1).End(xlUp).Row + 1
'Column A (1) of next row
.Cells(NextRow, 1).Value = ComboEmployees.Value
'Column B (2) of next row
.Cells(NextRow, 2).Value = DateBox.Value
'Column C (3) of next row
.Cells(NextRow, 3).Value = VacBox.Value
'Column D (4) of next row
.Cells(NextRow, 4).Value = PDBox.Value
'Column E (5) of next row
If OB1.Value = True Then
.Cells(NextRow, 5).Value = 8
Else
.Cells(NextRow, 5).ClearContents
End If
'Column F (6) of next row
.Cells(NextRow, 6).Value = AbsentBox.Value
End With
End Sub