Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Help needed on Macro
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Macro needed to set macro security in Excel to minimum | Excel Programming | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
Macro needed to Paste Values and prevent Macro operation | Excel Discussion (Misc queries) | |||
MACRO HELP NEEDED! | Excel Programming |