Hello,

I am trying to wirte a simple code that takes a cell value in a sheet, then checks if the active cell is equal to that, and if not offsets it down the column, and checks again until it is equal. After that the active cell is offset to the right and contents from another sheet pasted over the current data, however I have encounterd a problem.

The code as it is:

Sub WriteData()

Application.ScreenUpdating = False

ActiveWorkbook.Sheets("Employee Records").Activate

Range("B3").Select

Do

If (ActiveCell) = "Data Editor!D5" Then

ActiveCell.Select

Else

ActiveCell.Offset(1, 0).Select

End If

Loop Until (ActiveCell) = "Data Editor!D5"

ActiveCell.Value = xStaffNumber

ActiveCell.Offset(0, 1) = xSurname

ActiveCell.Offset(0, 2) = xForename

ActiveCell.Offset(0, 3) = xTelephone

ActiveCell.Offset(0, 4) = xJobLevel

ActiveCell.Offset(0, 4) = xBaseHours

ActiveCell.Offset(0, 5) = xBaseRate

ActiveCell.Offset(0, 6) = xExtraHours

ActiveCell.Offset(0, 7) = xExtraRate

Application.ScreenUpdating = True

End Sub

When I run it I encounter errors about a application or object defined error. Anyone know what is causing this and I can fix the code to get it working?

Thanks