View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Kevin B Kevin B is offline
external usenet poster
 
Posts: 1,316
Default Help needed on Macro

Perhaps this will work for you, copy it into a module and when your finished,
click TOOLS in the menu, click MACRO, MACROS. Select the macro named
TimeStamp and then click to OPTIONS command button and assign it the key
combination of your choice:

Sub TimeStamp()
Application.ScreenUpdating = False
ActiveSheet.Protect DrawingObjects:=False, Contents:=False,
Scenarios:=False
Columns("A:B").Locked = False
ActiveCell.Value = TimeSerial(Hour(Time), Minute(Time), Second(Time))
Columns("A:B").Locked = True
Selection.NumberFormat = "[$-409]h:mm AM/PM;@"
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Application.ScreenUpdating = True
End Sub
--
Kevin Backmann


"Gary" wrote:

Hi,

Heres what am trying to accomplish.

two columns (protected), column A - Start Time and Column B End Time.

now when a person starts working he needs to enter the current time
in...say... A1. I want that person to press a key combination that would run
a macro which will unprotect the both the columns, enter the current time in
the Selected cell, and protect both the columns again. same at the time of
End Time.

now I want the macro to enter the date only in the selected cell. but it
should unprotect and Protect both, entire columns. Also, when the columns
are protected, the user should be able to select the cells. please help.

Thanks.
Gary