Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Case sensitive and single character in cell


Hi all,

I have created an attendance database and I am not able to enter all
the required characters in the cell. I need "P", "A", "R" to be entered
in the cell and once entered, when editing, should ask for a password.
The problem in the below code is:
1. It is case sensitive
2. It does not take all the characters as mentioned above
3. Once a wrong data is entered, it is replaced with a blank but
instead I need the previous data which exists.

Please help me on this .

Your help is appreciated.

Thanks ,.
Praveen :)




Code:
--------------------

Private Sub Worksheet_Change(ByVal Target As Excel.Range)

'Sets the range to work in
Set hRange = Range("I15:CT36")

'Sets up for any string values (as errors)
On Error GoTo stringval

'Unprotects sheet with password "alcoa" CHANGE PASSWORD HERE AND BELOW
ActiveSheet.Unprotect "alcoa"

'Checks if changed cell was in Column I to CT
If Not Intersect(Target, hRange) Is Nothing Then

'Change was in Col H and value is 30 so - lock cell, reprotect sheet and exit
If Target.Value = "P" Then
Target.Locked = True
'THIS LINE REPLACE WITH NEW PROTECT CODE
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="alcoa"
Exit Sub
End If

'If entry in Col H was nonnumeric or not "P", clear entry from Col H
' and reprotect sheet. Do not lock cell at this time...
stringval:
Application.EnableEvents = False
Target.Value = ""
Application.EnableEvents = True

'AND THIS LINE REPLACE WITH NEW PROTECT CODE
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True, Password:="alcoa"

End If

End Sub

--------------------


--
praveen_khm
------------------------------------------------------------------------
praveen_khm's Profile: http://www.excelforum.com/member.php...o&userid=30364
View this thread: http://www.excelforum.com/showthread...hreadid=509342

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
countif function: how to distinguish case/make case sensitive mvwoolner Excel Worksheet Functions 3 March 18th 09 02:18 PM
How do I use case sensitive VLOOKUP? markythesk8erboi Excel Worksheet Functions 8 June 4th 08 04:44 PM
Case Sensitive w/ IF jeffP Excel Worksheet Functions 11 February 6th 06 01:16 AM
.Name case sensitive CinqueTerra Excel Programming 2 January 16th 06 08:57 PM
Case sensitive data Ian[_9_] Excel Programming 3 October 29th 03 06:16 PM


All times are GMT +1. The time now is 02:16 AM.

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"