Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default locking cell

Hello friends,
I need to create time sheets for work.. So I have created
a macro for entering the current time. But I do not want anyone to be able to
change the time once it is entered in that column. And any time entered in
the column should always be the current time

Below is my macro for current time
Private Sub cmd_time_Click()
ActiveCell.Clear
ActiveCell.FormulaR1C1 = "=NOW()"
ActiveCell.Value = ActiveCell.Value
End Sub

What do I do?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default locking cell

Private Sub cmd_time_Click()
ActiveSheet.Unprotect Password:="theword"
With ActiveCell
.Value = Format(Now, "h:mm:ss AM/PM")
.Locked = True
.Columns.AutoFit
End With
ActiveSheet.Protect Password:="theword"
End Sub

I would first unlock all cells before protecting the sheet originally.


Gord Dibben MS Excel MVP

On Tue, 30 Sep 2008 13:41:01 -0700, Dominic
wrote:

Hello friends,
I need to create time sheets for work.. So I have created
a macro for entering the current time. But I do not want anyone to be able to
change the time once it is entered in that column. And any time entered in
the column should always be the current time

Below is my macro for current time
Private Sub cmd_time_Click()
ActiveCell.Clear
ActiveCell.FormulaR1C1 = "=NOW()"
ActiveCell.Value = ActiveCell.Value
End Sub

What do I do?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,069
Default locking cell

there is a sample timesheet workbook you can download for free at this site
which may give you some development pointers.
http://spreadsheetpage.com/index.php/file/C35/P20/
--
jb


"Dominic" wrote:

Hello friends,
I need to create time sheets for work.. So I have created
a macro for entering the current time. But I do not want anyone to be able to
change the time once it is entered in that column. And any time entered in
the column should always be the current time

Below is my macro for current time
Private Sub cmd_time_Click()
ActiveCell.Clear
ActiveCell.FormulaR1C1 = "=NOW()"
ActiveCell.Value = ActiveCell.Value
End Sub

What do I do?

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
Locking cell whatzzup Excel Discussion (Misc queries) 2 November 1st 07 08:16 PM
locking only one cell AJB Excel Discussion (Misc queries) 2 August 17th 07 09:40 AM
locking formula in cells in without locking whole sheet SuziQ Excel Discussion (Misc queries) 1 July 21st 06 03:58 PM
Locking a cell John Excel Worksheet Functions 1 December 17th 05 01:04 PM
cell locking via VBA aken Excel Programming 3 June 20th 05 02:00 PM


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

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

About Us

"It's about Microsoft Excel"