Sorry, a pretty generic question, but can't find similiar questions really getting at what I need.
I need to move a date from Sheetx to Sheet7. On Sheetx the date value is stored in the C column and is merged across mulitple rows where there is more than 1 employee against that date. Employees are in column E. That value in column E is "ID FirstName Surname". I need to copy the date from Sheetx to Sheet7, where the location it needs to go is in column P on the row where that specific employee's ID is in Column C.
This process all starts with selecting the "ID FirstName Surname" cell on Sheetx, and IDs are 7 numbers long. I've been able to tweak this enough to stop getting any errors, but it isn't working:
Sub StartDateToDataSheet()
Dim i, ActiveRow, DataRow, EmpID As Long, StartDate As Date
EmpID = Left(ActiveCell.Value, 7)
DataRow = Application.Match(EmpID, Sheet7.Range("C2:C699"), 0)
ActiveRow = ActiveCell.Row
For i = ActiveRow To 6 Step -1
If Cells(i, 3) <> "" Then
StartDate = Cells(i, 3)
Exit For
End If
Next i
Sheet7.Cells(DataRow, 16) = StartDate
End Sub
Then something I haven't considered yet is a little error handling. The ID should always be on Sheet7, and I have a slight fear of a space at the beginning of " ID FirstName Surname".