3

I want to create a log file in excel.

I have created a macro that will insert in-time into active cell on ButtonInTime click. Similarly out time in the active cell on ButtonOutTime click...

Now i want to insert todays date on ButtonInTime click in previous cell of active cell

and calculate Total Log hours & insert it into next active cell of OutTime.

How i can achive this? Can any one help me out???

I tried to find out the solution, but didnt get the proper one...

Thanks in advance....

Anoop Pete
  • 492
  • 2
  • 4
  • 17

1 Answers1

3

I achieved it.. There are some hard codes in this....

Sub ButtonInTime_Click()
Range("A1").End(xlDown).Select

activecell.Offset(1, 0).Select
activecell.Value = Date
activecell.Offset(0, 1).Value = Time()
activecell.Offset(0, 3).Interior.Color = RGB(255, 0, 0)
activecell.Offset(0, 3).Value = "Log Not Closed!!!"


Range("A" & activecell.Row & ":E" & activecell.Row).Borders(xlEdgeTop).LineStyle = xlContinuous
Range("A" & activecell.Row & ":E" & activecell.Row).Borders(xlEdgeRight).LineStyle = xlContinuous
Range("A" & activecell.Row & ":E" & activecell.Row).Borders(xlEdgeBottom).LineStyle = xlContinuous
Range("A" & activecell.Row & ":E" & activecell.Row).Borders(xlEdgeBottom).LineStyle = xlContinuous

Range("B" & activecell.Row).Borders(xlEdgeRight).LineStyle = xlContinuous
Range("C" & activecell.Row).Borders(xlEdgeRight).LineStyle = xlContinuous
Range("D" & activecell.Row).Borders(xlEdgeRight).LineStyle = xlContinuous
Range("E" & activecell.Row).Borders(xlEdgeRight).LineStyle = xlContinuous

End Sub


Sub ButtonOutTime_Click()
Range("C1").End(xlDown).Select
activecell.Offset(1, 0).Select

activecell.Value = Time()
activecell.Offset(0, 1).Value = activecell.Value - activecell.Offset(0, -1).Value
activecell.Offset(0, 1).Interior.Color = RGB(255, 255, 255)


End Sub
Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
Anoop Pete
  • 492
  • 2
  • 4
  • 17