Try this...
Private Sub RecordHours_Click()
Application.EnableEvents = False
Application.ScreenUpdating = False
Dim rowCell As Range
Dim colCell As Range
Dim wsSource As Worksheet
Dim wsDest As Worksheet
Dim valChange As Double
Dim strCol As Date
Dim strRow As String
Dim dosubtract As Boolean
Set wsSource = Worksheets("Main")
Set wsDest = Worksheets("Hours")
'Gather data
With wsSource
valChange = .Range("C16").Value
strCol = Format(.Range("C14").Value, "mm/dd/yyyy")
strRow = .Range("C18").Value
End With
With wsDest
Set colCell = .Range("1:1").Find(strCol, , xlValues, xlWhole, , xlNext, False)
Set rowCell = .Range("A:A").Find(strRow, , xlValues, xlWhole, , xlNext, False)
'Error check
If colCell Is Nothing Then
MsgBox "Could not find Date"
ElseIf rowCell Is Nothing Then
MsgBox "Could not find Company"
Else
With .Cells(rowCell.Row, colCell.Column)
If dosubtract Then
.Value = .Value - valChange
Else
.Value = .Value + valChange
End If
End With
End If
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Bookmarks