Click here to Skip to main content
15,891,902 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Experts,


How should i restrict an individual cell to be edited in a spread sheet after entering a value using macros.

i.e., An individual cell in the google spread sheet should accept a value only for one time.
Posted
Updated 3-Sep-13 22:20pm
v4
Comments
Bala Selvanayagam 2-Sep-13 5:42am    
You mean locking an EXCEL spread sheet cell using JavaScript ?

As far as i know, you can not use JavaScript to manage EXCEL. You may have to look into some EXCEL VBA/MAcros, if am not mistaken
Harsha24 2-Sep-13 5:45am    
yup.. thanks for the info.. could u pls help me on this..
Bala Selvanayagam 2-Sep-13 5:54am    
Have a look at

http://www.mrexcel.com/forum/excel-questions/213186-lock-cell-macro.html

Also, you can google on this and you will have many suggestions/ solutions

1 solution

u Can try some thing like this...
VB
Public RunWhen As Double
 Const cRunIntervalSeconds = 60    'Specify the seconds after which the macro has to run...
 Const cRunWhat = "LockCell"
 
 Private Sub Workbook_open()
    StartTimer
 End Sub

Sub StartTimer()
    RunWhen = Now + TimeSerial(0, 0, cRunIntervalSeconds)
    Application.OnTime EarliestTime:=RunWhen, Procedure:=cRunWhat, Schedule:=True
End Sub

Sub LockCell()
    Sheets("Sheetname").Range("A1").Locked = True
    'MsgBox "Process Completed"
    StartTimer
End Sub

in the above one am running the lockcell macro after every 60 seconds...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900