Process different project hours for the same employee on the same worksheet.
Check for extra hours worked on Monday:
If Nz(![MondayHours]) + _
Nz(![MondayOTHours]) > 0 Then
Determine whether any hours were added for this day:
appExcel.GoTo _
Reference:=wks.Range(“Monday”)
Set rngCC = _
appExcel.ActiveCell.Offset(columnoffset:=2)
If rngCC.Value <> “” Then
Go to next day and insert a new row above:
appExcel.GoTo _
Reference:=wks.Range(“Tuesday”)
appExcel.ActiveCell.Select
appExcel.Selection.EntireRow.Insert
Set rngCC = _
appExcel.ActiveCell.Offset(columnoffset:=2)
Set rngPC = _
appExcel.ActiveCell.Offset(columnoffset:=3)
Set rngRH = _
appExcel.ActiveCell.Offset(columnoffset:=4)
Set rngOT = _
appExcel.ActiveCell.Offset(columnoffset:=5)
rngCC.Value = ![ClientCode]
rngPC.Value = ![ProjectCode]
rngRH.Value = ![MondayHours]
rngOT.Value = ![MondayOTHours]
Set rngTotalAbove = _
appExcel.ActiveCell.Offset(rowoffset:=-1, _
columnoffset:=6)
Set rngTotal = _
appExcel.ActiveCell.Offset(columnoffset:=6)
rngTotalAbove.Select
Copy Total formula from cell above:
appExcel.Selection.Copy
rngTotal.Select
wks.Paste
appExcel.CutCopyMode = False
Else
Part II Writing VBA Code to Exchange Data between Office Components