Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 143
Default 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   Report Post  
Posted to microsoft.public.excel.programming
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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
Macro needed to set macro security in Excel to minimum Carl Excel Programming 3 March 18th 06 03:36 PM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM
MACRO HELP NEEDED! acw[_2_] Excel Programming 0 February 27th 04 01:45 AM


All times are GMT +1. The time now is 09:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"