Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 287
Default Allow entry only once

Is it possible to set validation/event on every cell in a column that input
can be entered only once, i.e. if I enter 2005-05-26 in a cell it is fixed
and cannot be changed??
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Allow entry only once

There can be many ways but one approach could be the following. Paste the
code into the Sheet1's code

Dim rng As Range
Dim bHasValue As Boolean

Private Sub Worksheet_Change(ByVal Target As Range)
If Application.Intersect(Target, rng) Then
If bHasValue Then
Application.EnableEvents = False
Application.Undo
Application.EnableEvents = True
End If
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
On Error Resume Next
Set rng = Application.Intersect(Target, Sheet1.Columns(1)).Cells(1)
bHasValue = (rng.Value < "")
End Sub

Alok Joshi

"Adam" wrote:

Is it possible to set validation/event on every cell in a column that input
can be entered only once, i.e. if I enter 2005-05-26 in a cell it is fixed
and cannot be changed??

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
Can I lock a cell after data entry so entry can not be changed Verlinde Excel Discussion (Misc queries) 3 April 22nd 10 07:59 PM
Excel 2002 date entry: Cannot get away from d-m-yy entry format Steve Eklund Excel Discussion (Misc queries) 3 May 11th 09 04:57 PM
Control Data Entry - push entry to next cell Ofelia Excel Discussion (Misc queries) 0 July 7th 08 04:19 PM
Auto entry of data based on entry of text in another column or fie Judy Rose Excel Discussion (Misc queries) 2 May 21st 08 01:14 PM
Cell Entry That Locks Selected Cells From Any Data Entry. ron Excel Worksheet Functions 5 February 16th 07 09:52 PM


All times are GMT +1. The time now is 04:10 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"