Hi all I have a code that I'm trying to get to work and I am lost to know why it doesnt work.
I have many worksheets, the first is named "Welcome" the rest are named employee numbers ranging from 100 to 999. However the numbers are for every employee that ever worked for our company and now have gaps in the numbering of the tabs due to people leaving the company. e.g. 100, 101, 105, 130, 145, 250 and so on. I am trying to get a macro to run at 11:00am so that this will clock them out for lunch. This needs to be done on every worksheet other then the "welcome" sheet.
Hope you all can help.
Zyhin
I have many worksheets, the first is named "Welcome" the rest are named employee numbers ranging from 100 to 999. However the numbers are for every employee that ever worked for our company and now have gaps in the numbering of the tabs due to people leaving the company. e.g. 100, 101, 105, 130, 145, 250 and so on. I am trying to get a macro to run at 11:00am so that this will clock them out for lunch. This needs to be done on every worksheet other then the "welcome" sheet.
Code:
Sub LunchTimeStart()
Application.OnTime TimeValue("11:00:00"), "LunchTimeStart"
Dim TabNumber%
LastRow = Worksheets(TabNumber).Cells.Find(what:="*", searchdirection:=x1Previous, searchorder:=x1ByRows) .Row
For TabNumber = 100 to 999
Worksheets(TabNumber).Cells(LastRow, 6).Value = Time
Worksheets(TabNumber).Cells(LastRow, 7).Value = "hh:mm:ss;@"
Worksheets(TabNumber).Cells(LastRow, 6).Formula = Worksheets(TabNumber).Cells(LastRow, 6) - Worksheets(TabNumber).Cells(LastRow, 5)
Next TabNumber
End Sub
Hope you all can help.
Zyhin