Lock Cells Automatically After Entering Via Macro Code

Apr 23, 2008

I have an excel sheet which has a macro which captures the current time in a cell with the formula =now(). What I am looking for is that once a user runs a macro and the time is inserted into that cell then that cell should be locked and cannot be changed then. If this can be done by any formula / function or VBA.

View 2 Replies


Automatically Lock Cells In VBA Code?

Nov 12, 2013

I have a code which should automatically lock the cells when ever i change a certain value of cells. the code is given below. But the change doesn't happen. I've first protected the sheet then using code unlock and then again protect the sheet after locking the cells. I'm getting no errors but the cell doesn't get locked.

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 14 Then
ActiveSheet.Unprotect Password:="password"


View 5 Replies View Related

VBA Code To Lock Cell After Entering Data

Feb 2, 2014

I have a worksheet, i want to lock the data entered in a cell of a particular column . e.g. if i will enter the data in A2, A2 should be locked, when user enter data in cell A3, A3 should be locked. I want this code to apply on multiple columns (A,C,E,G).

View 3 Replies View Related

Automatically Lock & Protect Cells

Nov 27, 2006

I have a grid used as a shared diary and I need to automatically protect a cell by changing its colour to red, can this be done using VBA?

View 9 Replies View Related

How To Automatically Lock Cells Every Time Input A Value

May 6, 2004

a code that would automatically lock a cell every time I input a value to it?

View 2 Replies View Related

Automatically Lock Cells When Data Entered

Apr 16, 2008

I am trying to apply a conditional cell lock to a worksheet. I am using Excel 2003, not 2007.

In column J, I have a list validation being used. The default value is "Not Claimed", I want to lock the cell from being edited once the value has been changed to any other value on the list.

The worksheet will be password protected to prevent entries into static fields (A:I & N:P).

I also would like to give the user the ability to unlock a specific cell, not the entire worksheet, by entering a password or something if they accidently choose a wrong value from the list.

I have column Q and beyond available if I need to have the password entered somewhere else.

I have attached a sample of the file I am working with.

View 4 Replies View Related

Automatically Lock Other Cells And Should Show Error Message?

May 2, 2012

I need a macro where user choose a value from validation, automatically lock the other cells and should show an error message.

Here is what I am looking for. User will choose Yes or no from cell H15 validation. If user choose "NO" from the validation then all other cells has to be locked in the workbook automatically except Cell H15 and a msg box needs to appear stating: "Select Yes from the validation".

View 3 Replies View Related

Lock Data In Cell After Entering Value?

Feb 2, 2014

0: i have a sheet 1 protected and few edit range (Col A,B,C,D,E and F).

1: I have a validation on multiple adjacent columns (like Col A, Col C, Col E).
2: I need a code where if i select value in col a (cell A2) cell B2 should get current date and Time and both the cells (A2 and B2) should be locked. when i select data in cell C2 , D2 should get current date and time(Cell C2 and D2 should be protected).
3: User can enter data in A3 and B3 will get current date and Time (now A3 and B3) should be locked.
4: I need a function where user can call it and unlock the locked cells and edit the data and re-lock the cells again.

apart from the Col A,B,C,D,E and F, other columns and cells remain locked.

View 2 Replies View Related

Cell Auto-lock After Entering Time

Sep 16, 2013

I have created a time sheet and I would like to know if there is a way to auto-lock cells after time is entered so that it cannot be changed. As of right now I have employees enter the time by using Shift+Ctrl+;, so the exact time is recorded, however employees can write in whatever time they want. so I guess what I want to do is 2 things:

1- can the cell be formatted to only accept Shift+Ctrl+;, so that the exact time is entered in the cell and prevent employees from entering times they were not at work?


2- can the cell auto-lock after Shift+Ctrl+; is entered so that they can't modify the time sheet the next day if they arrived earlier than the day before?

View 5 Replies View Related

Lock Cells Based On Value Of Other Cells - Code Simplification Query

Apr 22, 2009

I'm using the code below to lock certain cells depending on the value of other cells. The code below deals with one line of my spreadsheet only and as the spreadsheet comprises 38 data entry rows I've repeated this code 38 times in the worksheet module with the appropriate changes to row numbers.

It works, but causes much screen flickering and "thinking". I'm new to vba so no doubt I've made this code too extensive or lengthy or whatever (or just plain wrong).

Can anyone assist with suggestions on how to simplify the code and/or help with code to handle all 38 lines without repeating the routine 38 times?

View 7 Replies View Related

Lock Cells After Today's Date Passed (VBA Excel Code)

Apr 9, 2009

I am trying to lock cells after today's date has passed so that no one can make changes to it after today's date has lapsed. This is for protective reasons so that people do not remove their names from reserving something after using it. Now the code should disallow locking after cell input entry when today's date hasn't passed so that changes can still be made by the user. I am trying to determine the code to do this but I have no idea as to how to do it.

Here's a scenario: I reserve something for Aprill 11, 2009. I input my name. Since it's April 9th, 2009, I am still able to make changes up and until April 11, 2009. After this date, the cell is locked and no changes can be made, except for the administrator.

View 14 Replies View Related

How To Make Macro To Lock Certain Cells Connected To Another Cells Value Then Copy Daily

Mar 29, 2014

am making Excel for private use, i need the following makro to be active, here is the idea because i didnt yet work with makros at all:

If A1 = False
then Range B1:D1 will be locked cells

If A1 = True
then Range B1:D1 will be unlocked cells

Those rules apply to 1 day in the year.

the range A1:D1 will be copied about 400 so the makro should be active to each day separatly.

Check the picture attached for example of one day

View 1 Replies View Related

Dynamic Macro To Lock Cells That Contain Any Value

Feb 10, 2014

I'm currently using this macro:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim Rng
Dim MyCell
Set Rng = Range("A1:AA7672")
For Each MyCell In Rng

[Code] ....

The problem is that it is not dynamic and it's super slow. The larger my range is the slower it operates and right now it's almost unusable.

The workbook I am using gets touched by 10 different people and I want to prevent tampering. I want for the workbook to be, when protected, have all the blank cells editable and once a value is inserted, it cannot be edited again and not work so unbelievably slow.

View 5 Replies View Related

Automate Macro And Lock Cells

Oct 6, 2008

I have a macro in Module1 of workbook "BAU" called "ExtractToSheets" which exports data depending on the contents of a cell (Thanks royUK et al)

At the moment however, you must run the macro manually to export the data.

Now, i have put some simple validation in column K of worksheet "BAU Data" within the "BAU" workbook. Whenever a cell within a predefined range with column K is changed to "Yes" i want the macro to run AND i want the row the cell is in to be locked so it cannot be edited further by the user. I have had too many users mess up previous sheets i have made to collect my data, and i wish to make this one somewhat more idiot-proof!
Any pearls of wisdom folks?

I would have attached a representation of my sheet, unfortunately because there is now a macro in my spreadsheet, our trigger-happy security software won't let me post it!

View 14 Replies View Related

Macro Filter And Then Lock Cells

Oct 18, 2012

I have a search form that will filter the result based on the requested category. Is it possible to lock the cells once it has been filtered and then remove the lock after they close the workbook?

View 2 Replies View Related

Macro To Lock Cells After Data Entered

Mar 22, 2007

I need a macro which will lock the cells after data is entered in the cell once. Cell should become non editable and should be only edited after a password is provided.

View 4 Replies View Related

Macro To Lock All Non-Blank Cells After Saving Workbook

Jul 23, 2014

I have been searching for a macro that would lock all the non blank cells (cells that have any value/text) after the workbook is saved.

When the user clicks on save a message box should prompt stating that "The data you entered has been locked successfully".

View 4 Replies View Related

Macro To Lock A Number Cells After Changing A Cell

Jan 5, 2009

I have an excel sheet which is protected (mainly so that the users will not change any formulas) the excel sheet is basically a list

Just to put you in the picture
Column B Is PO Number
Column C Is Remarks
Column D Date
Column E Description
Column F Supplier
Column G Amount

I would like that when Column C changes to "OK Checked" column B C D E F G are protected and locked. But obviously for that particular row.

For example the input of Cell C15 changes to "OK Checked" then B15, C15,E15,F15,G15.
the macro must NOT be fixed to a particular row (in this case 15)

View 9 Replies View Related

Entering Text Automatically

May 4, 2009

I really DO have a problem. I need excel to create me a list of whenever someone enters their name. Now, this may sound simple, but, the text in the list CANNOT be allowed to be overwritten.Also the text needs to be entered into the NEXT empty cell between C30 and C50. This is basically so I can keep a record of whenever anybody does anything/modifies the cells that include text between S7 andS21

So basically if text is ever entered into S7 all the way down to S21, I need an automatic copy created into the next available cell between C30 and 390. It is also ok if there are duplicates values(names).

I would give a print screen, but I don't know where the attach button is on this forum.

View 11 Replies View Related

Adjust Value Automatically When Entering New Value

Dec 10, 2013

In simplicity: We want to be able to enter a value in cell A1 (and hit enter), but we want the value in A1 to be increased by the value saved in H1.

So: if H1 had 250 saved in it, if we enter 150 in A1 (and hit enter), we want the value in A1 to become 400.

View 2 Replies View Related

Entering Data Automatically

May 19, 2009

I have two files which are attached.

One is the main report file "ops report.xls" and other is the raw file (Air.xlsx) from which data is to be added to this file. i manually take the data and enter it into the ops report everyday. This i want to automate as there are many such sheets to be completed (i have mentioned just "Air" sheet here in ops report).

Now what exactly i want to do is?

take data from Air.xlsx workbook as per the columns in the Air sheet in Ops report and paste it on that particular date row. this i will have to do everyday so the nest day the data will be pasted on next row against the date. The yellow columns which i have marked have formula so you need not touch that columns.

I nee to paste the average of Air sales and Air service. so we have to take average of row 43 and row 89 for first two columns in ops report. and then average of row 44 and row 90 for column L,N,O,P,Q in the ops report.

Afterwards the average of column J must be pasted in "Interval" sheet in ops report.

This is a bit tough but i know there are many genius people out there who can easily solve this.

View 10 Replies View Related

Macro To Lock Cells In Protected Sheet Depending On Criteria

Dec 13, 2007

I have a Workbook that I use to log invoices and credit notes and it is password protected so that the cells that contain formulas are locked and therefore not selectable.

What I wanted to know is. Is it possible to lock other cells depending on what values are in certain cells?

Let me explain. I have Columns G & H which contain the heading 'Credit Note Number' & 'Credit Note Amount'. Now in columns I & J I have the heading 'Invoice Number' & 'Invoice Amount' respectively.

What I have done is to make a condional formatting so that If I put a value in cells in column G it will change the colour of the adjacent cells in columns I & J, likewise If I fill in cells in column I the conditional formatting will change the colour of adjacent cells in coulumn G & H. This helps me to see whether a row contains a credit note or an invoice.

What I would ideally like is for a Macro that would automatically locks cells G & H in a particular row that I am currently working on if I enter data into the cell in column I. Likewise if I am entering data in column G in the row I am currently working on for a credit note, then lock columns I & J in the row I am currently in.

Any Ideas how this can be done? Also can locking and unlocking of cells be done in VBA while the sheet is protected or would the macro need to temporarily unprotect sheet, lock the cells then protect sheet again?

PS: I have uploaded a Jpeg of what my conditional formatting does to try and illustrate what it is I need.

View 14 Replies View Related

Conditional Macro - Insert Text And Lock All Duplicate Cells Except For First One

Sep 16, 2012

I am new to VBA but I am trying to insert text and lock all duplicate cells except for the first one. Below is the macro I am trying to make. I keep getting an error on the line:


This is my macro:

Sub SetVoters()
' SetVoters Macro

Sub SetVoters()
' SetVoters Macro


[Code] ......

View 1 Replies View Related

Lock Cells To Prevent Predefined Range Macro Copying

Oct 30, 2012

I have a spreadsheet that allows users to paste set data from a PDF Image (using OCR) straight into Excel and then use the MID function to split the data accordingly.

Unfortunately, the OCR isn’t too intuitive and gets it wrong sometimes.

So to counter this, in another sheet (in the same workbook) I have a manual input section, and a simple macro button that pastes this data into the same fields where the OCR text would be, so that the main sheet works exactly the same way as before.

The problem is, and most likely due to the simplicity of the sheet, if a combination of OCR pasting and manual inputting is used, when I hit the paste button, it over rides the OCR data with blank cells

In the link below I have shown what is currently happening (1, 2, 3), and an example of what I would actually like it to do (4, 5, 6).

Example - Online Spreadsheets - EditGrid

So, in the 2nd scenario, I would like “5” to recognise that the respective cells in “4” already contain data and fill them ‘Grey’. This I have already achieved with basic conditional formatting.

However, I need to take it 1 step further and say that if the parent sheets cell (Auto OCR) contains data, as well as filling cells (in sheet Manual) lock these cells off and prevent the end user from adding data and/ or being copied over to the parent sheet.

Is this possible?

The result then being the parent sheet with both OCR text and copied text from the manual input sheet.

Both sheets are protected anyway and only allow for user input in certain areas, so is it even possible to apply further protection once the sheet is locked already?

View 1 Replies View Related

Divide By X Automatically In Same Cell Upon Entering A Value

Mar 24, 2007

How do I enter a value into a cell and divide that number automatically by another value all within the same cell.

For example..

I want to enter 20 into a cell and have it change into 17.24 (20/1.16) automatically all within that same cell.

View 3 Replies View Related

Automatically Colour Code Cells

Sep 25, 2009

Is there a way to automatically conditionally format each column in each row, when either open, closed or cancelled is selecting from a drop down in the Status column. For example every cell is blank in colour, but if I select open in the drop down menu for row A2, the entire row will turn Red. Just wondered if there is a way instead of individually formatting every row separately. I would like to be able to copy the formula or whatever down the entire sheet.

View 2 Replies View Related

VBA Code To Add Hyperlinks To Cells Automatically?

Mar 12, 2014

I have a workbook with dozens of filled cells.

The cells contian the file names: "filen_name.extension" (for example word.doc)

Also I have these files located in some directory.

Is there any possibility to add simoltaneously links to the cells which contain the appropriate file name.

View 2 Replies View Related

Automatically Run Macro Code Every X Seconds

May 2, 2008

i have a caclulate event that I want to run constantly while the workbook is open. How can I do this? below is the code for the calculate event:

Private Sub worksheet_calculate()
If Sheets("Messing Around"). Range("e14") <> changeval Then
If ActiveSheet.Range("E14").Value = "T1/E1" Then
Sheets("Messing Around").Range("e15").Activate
ActiveCell.PasteSpecial Paste:=xlPasteValues
ElseIf ActiveSheet.Range("E14").Value = "DS3/E3" Then

View 4 Replies View Related

How To Lock A Cell Date Automatically After User Saves Changes

Oct 15, 2011

how to lock a cell date automatically after the user saves changes, it's current format it is a tick box with a reference cell Today() but it need to be locked once completed,

View 5 Replies View Related

Automatically Lock / Protect Formula Cell When Entered

Feb 26, 2008

I need to create a macro to where once a cell has had a formula or data inputed that it locks afterwards and cannot be edited without unportecting the sheet or not at all. The problem is I have no idea how to program in VBA. I can get there and select the worksheet but after that I am stumped. How would I enter the macro and what should the macro look like?

View 2 Replies View Related

Copyrights 2005-15 www.BigResource.com, All rights reserved