hi all,
I'm trying to build a time sheet database where each team member can fill in their time spent per week/day/project/project phase. I have build a worksheet for each member; they all look the same and include row 5:25 all projects and on columns I have Monday-Sunday (C4,E4,G4,I4,K4,M4,O4) and for each day a description cell where they can fill in the project phase from a drop-down list (D4,F4,H4,J4,L4,N4,P4). Above I have the team member name (A1) and end of week date (B2). Then I constructed a command button "Submit" which should transfer the data into a database sheet where I have the following headings: End of week, day, hours, project, project phase, team member (A2:F2) and which I want to be populated automatically when they click on the button.
So far I have the following code but it returns only the first entry in the time-sheet, respectively the hours worked on Monday ("C4") on the first project ("B5").
Do you know how to develop the code to look also into the following project lines (B6:B25) and to the following days (E4,G4,I4,K4,M4,O4)? Thanks so much!!
Private Sub CommandButton1_Click()
Dim Period As Date, Hours As Long, ProjectPhase As String, Day As String, Deal As String, TeamMember As String
Worksheets("Johnny").Select
Period = Range("b2")
Hours = Range("C5")
ProjectPhase = Range("D5")
Day = Range("c4")
Deal = Range("b5")
TeamMember = Range("a1")
Worksheets("Database").Select
Worksheets("Database").Range("a2").Select
If Worksheets("Database").Range("a2").Offset(1, 0) <> "" Then
Worksheets("Database").Range("a2").End(x1Down).Offset(1, 0).Select
End If
ActiveCell.Offset(1, 0).Select
ActiveCell.Value = Period
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Day
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Hours
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = Deal
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = ProjectPhase
ActiveCell.Offset(0, 1).Select
ActiveCell.Value = TeamMember
Worksheets("Johnny").Select
Worksheets("Johnny").Range("C5:p25").ClearContents
End Sub
Bookmarks