Disable a cell in excel using VB code
Solved/Closed
Jinto
-
Apr 12, 2012 at 04:43 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jan 28, 2016 at 11:10 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Jan 28, 2016 at 11:10 AM
Related:
- How to disable a cell in excel based on condition
- How to disable images on chrome android - Guide
- Based on the values in cells b77 b81 ✓ - Excel Forum
- How to disable javascript in tor - Guide
- Number to words in excel - Guide
- How to take screenshot in excel - Guide
7 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
552
May 1, 2012 at 08:28 AM
May 1, 2012 at 08:28 AM
Hi Jinto,
Once you have unblocked all cells (Ctrl+a to select all cells, Ctrl+1 to goto cell properties, final tab protection).
You can try this code:
Best regards,
Trowa
Once you have unblocked all cells (Ctrl+a to select all cells, Ctrl+1 to goto cell properties, final tab protection).
You can try this code:
Private Sub Worksheet_Change(ByVal Target As Range) If Target <> Range("A1") Then Exit Sub ActiveSheet.Unprotect If Range("A1").Value = "xyz" Then Range("B1").Locked = True Range("C1").Locked = False Range("D1").Locked = False End If If Range("A1").Value = "abc" Then Range("B1").Locked = False Range("C1").Locked = True Range("D1").Locked = False End If If Range("A1").Value = 123 Then Range("B1").Locked = False Range("C1").Locked = False Range("D1").Locked = True End If If Range("A1").Value = "" Then Range("B1").Locked = False Range("C1").Locked = False Range("D1").Locked = False End If ActiveSheet.Protect End Sub
Best regards,
Trowa
Jun 13, 2014 at 03:44 AM
I have a problem. I modified the code according to my needs but it doesn't seem to work. Is there a specific place where I should put the code so that it will work. I am new with working with macros. So I am looking forward to your help.
Regards
Sneha
Jun 16, 2014 at 11:19 AM
To correctly place this code is to right-click the sheets tab of which you want to apply the code to and select view code. Then paste the code in the big white field that appears.
Let me know if I can assist further.
Best regards,
Trowa
Mar 10, 2015 at 05:41 AM
use this simple IF formula
=IF(C3="No","NA"," ")
if C3 = NO or something else then your value will be NA or something that you define