ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro To Lock Certain Cells... Please Help (https://www.excelbanter.com/excel-programming/356337-macro-lock-certain-cells-please-help.html)

tahir

Macro To Lock Certain Cells... Please Help
 

Hi,

Scenario:
I am working on a sheet that has a column G and Colum H, Column
contains validated list containing values "Yes" and "No", When i choos
"Yes" from any cell in G column the value in the H column adjacent cel
turns to "No", but if i choose "No" from column G the value in H colum
turns "Yes".

Problem:
My problem is related to locking the cell that have a value of "No"
means as soon as the value "No" gets into any cell in Column H th
related cell should be locked for editing. Simply any cell in G or H i
has "No" must be locked. else Open for editing.

Hope Someone will Help,

Regards,

Tahi

--
tahi

Student, working on a projec
-----------------------------------------------------------------------
tahir's Profile: http://www.excelforum.com/member.php...nfo&userid=605
View this thread: http://www.excelforum.com/showthread.php?threadid=52365


tahir

Macro To Lock Certain Cells... Please Help
 

tahir Wrote:
Hi,

Scenario:
I am working on a sheet that has a column G and Colum H, Column
contains validated list containing values "Yes" and "No", When i choos
"Yes" from any cell in G column the value in the H column adjacent cel
turns to "No", but if i choose "No" from column G the value in H colum
turns "Yes".

Problem:
My problem is related to locking the cell that have a value of "No"
means as soon as the value "No" gets into any cell in Column H th
related cell should be locked for editing. Simply any cell in G or H i
has "No" must be locked. else Open for editing.

Currently i m using this code but it do not have locking or protectin
the cells that contain "No" Value.

********Start of Code********
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range
If Intersect(Target, Range("G2:G60", "k2:k60")) Is Nothing Then Exi
Sub
Application.EnableEvents = False
If Target.Value = "Yes" Then
Target.Offset(0, 1).Value = "No"
Else
If Target.Value = "No" Then
Target.Offset(0, 1).Value = "Yes"
Else
Target.Offset(0, 1).Value = ""
Application.EnableEvents = False
If Target.Value = "New" Then
Target.Offset(0, 1).Value = "Old"
Else
If Target.Value = "Old" Then
Target.Offset(0, 1).Value = "New"
Else
Target.Offset(0, 1).Value = ""
End If
End If
End If
End If
Application.EnableEvents = True
End Sub
********End of Code********

Hope Someone will Help,

Regards,

Tahir



Please Help Me on this , I m really stuck, This is my third day bu
cant figure out how to lock the cells on selection of values from othe
cell

--
tahi

Student, working on a projec
-----------------------------------------------------------------------
tahir's Profile: http://www.excelforum.com/member.php...nfo&userid=605
View this thread: http://www.excelforum.com/showthread.php?threadid=52365


tahir

Macro To Lock Certain Cells... Please Help
 

tahir Wrote:
Hi,

Scenario:
I am working on a sheet that has a column G and Colum H, Column
contains validated list containing values "Yes" and "No", When i choos
"Yes" from any cell in G column the value in the H column adjacent cel
turns to "No", but if i choose "No" from column G the value in H colum
turns "Yes".

Problem:
My problem is related to locking the cell that have a value of "No"
means as soon as the value "No" gets into any cell in Column H th
related cell should be locked for editing. Simply any cell in G or H i
has "No" must be locked. else Open for editing.

Currently i m using this code but it do not have locking or protectin
the cells that contain "No" Value.

********Start of Code********
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range
If Intersect(Target, Range("G2:G60", "k2:k60")) Is Nothing Then Exi
Sub
Application.EnableEvents = False
If Target.Value = "Yes" Then
Target.Offset(0, 1).Value = "No"
Else
If Target.Value = "No" Then
Target.Offset(0, 1).Value = "Yes"
Else
Target.Offset(0, 1).Value = ""
Application.EnableEvents = False
If Target.Value = "New" Then
Target.Offset(0, 1).Value = "Old"
Else
If Target.Value = "Old" Then
Target.Offset(0, 1).Value = "New"
Else
Target.Offset(0, 1).Value = ""
End If
End If
End If
End If
Application.EnableEvents = True
End Sub
********End of Code********

Hope Someone will Help,

Regards,

Tahir



Please Help Me on this , I m really stuck, This is my third day bu
cant figure out how to lock the cells on selection of values from othe
cell

--
tahi

Student, working on a projec
-----------------------------------------------------------------------
tahir's Profile: http://www.excelforum.com/member.php...nfo&userid=605
View this thread: http://www.excelforum.com/showthread.php?threadid=52365


tahir

Macro To Lock Certain Cells... Please Help
 

tahir Wrote:
Hi,

Scenario:
I am working on a sheet that has a column G and Colum H, Column
contains validated list containing values "Yes" and "No", When i choos
"Yes" from any cell in G column the value in the H column adjacent cel
turns to "No", but if i choose "No" from column G the value in H colum
turns "Yes".

Problem:
My problem is related to locking the cell that have a value of "No"
means as soon as the value "No" gets into any cell in Column H th
related cell should be locked for editing. Simply any cell in G or H i
has "No" must be locked. else Open for editing.

Currently i m using this code but it do not have locking or protectin
the cells that contain "No" Value.

********Start of Code********
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range
If Intersect(Target, Range("G2:G60", "k2:k60")) Is Nothing Then Exi
Sub
Application.EnableEvents = False
If Target.Value = "Yes" Then
Target.Offset(0, 1).Value = "No"
Else
If Target.Value = "No" Then
Target.Offset(0, 1).Value = "Yes"
Else
Target.Offset(0, 1).Value = ""
Application.EnableEvents = False
If Target.Value = "New" Then
Target.Offset(0, 1).Value = "Old"
Else
If Target.Value = "Old" Then
Target.Offset(0, 1).Value = "New"
Else
Target.Offset(0, 1).Value = ""
End If
End If
End If
End If
Application.EnableEvents = True
End Sub
********End of Code********

Hope Someone will Help,

Regards,

Tahir



Please Help Me on this , I m really stuck, This is my third day bu
cant figure out how to lock the cells on selection of values from othe
cell

--
tahi

Student, working on a projec
-----------------------------------------------------------------------
tahir's Profile: http://www.excelforum.com/member.php...nfo&userid=605
View this thread: http://www.excelforum.com/showthread.php?threadid=52365


tahir

Macro To Lock Certain Cells... Please Help
 

tahir Wrote:
Hi,

Scenario:
I am working on a sheet that has a column G and Colum H, Column
contains validated list containing values "Yes" and "No", When i choos
"Yes" from any cell in G column the value in the H column adjacent cel
turns to "No", but if i choose "No" from column G the value in H colum
turns "Yes".

Problem:
My problem is related to locking the cell that have a value of "No"
means as soon as the value "No" gets into any cell in Column H th
related cell should be locked for editing. Simply any cell in G or H i
has "No" must be locked. else Open for editing.

Currently i m using this code but it do not have locking or protectin
the cells that contain "No" Value.

********Start of Code********
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range
If Intersect(Target, Range("G2:G60", "k2:k60")) Is Nothing Then Exi
Sub
Application.EnableEvents = False
If Target.Value = "Yes" Then
Target.Offset(0, 1).Value = "No"
Else
If Target.Value = "No" Then
Target.Offset(0, 1).Value = "Yes"
Else
Target.Offset(0, 1).Value = ""
Application.EnableEvents = False
If Target.Value = "New" Then
Target.Offset(0, 1).Value = "Old"
Else
If Target.Value = "Old" Then
Target.Offset(0, 1).Value = "New"
Else
Target.Offset(0, 1).Value = ""
End If
End If
End If
End If
Application.EnableEvents = True
End Sub
********End of Code********

Hope Someone will Help,

Regards,

Tahir



Please Help Me on this , I m really stuck, This is my third day bu
cant figure out how to lock the cells on selection of values from othe
cell

--
tahi

Student, working on a projec
-----------------------------------------------------------------------
tahir's Profile: http://www.excelforum.com/member.php...nfo&userid=605
View this thread: http://www.excelforum.com/showthread.php?threadid=52365


tahir

Macro To Lock Certain Cells... Please Help
 

tahir Wrote:
Hi,

Scenario:
I am working on a sheet that has a column G and Colum H, Column
contains validated list containing values "Yes" and "No", When i choos
"Yes" from any cell in G column the value in the H column adjacent cel
turns to "No", but if i choose "No" from column G the value in H colum
turns "Yes".

Problem:
My problem is related to locking the cell that have a value of "No"
means as soon as the value "No" gets into any cell in Column H th
related cell should be locked for editing. Simply any cell in G or H i
has "No" must be locked. else Open for editing.

Currently i m using this code but it do not have locking or protectin
the cells that contain "No" Value.

********Start of Code********
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim MyRange As Range
If Intersect(Target, Range("G2:G60", "k2:k60")) Is Nothing Then Exi
Sub
Application.EnableEvents = False
If Target.Value = "Yes" Then
Target.Offset(0, 1).Value = "No"
Else
If Target.Value = "No" Then
Target.Offset(0, 1).Value = "Yes"
Else
Target.Offset(0, 1).Value = ""
Application.EnableEvents = False
If Target.Value = "New" Then
Target.Offset(0, 1).Value = "Old"
Else
If Target.Value = "Old" Then
Target.Offset(0, 1).Value = "New"
Else
Target.Offset(0, 1).Value = ""
End If
End If
End If
End If
Application.EnableEvents = True
End Sub
********End of Code********

Hope Someone will Help,

Regards,

Tahir



Please Help Me on this , I m really stuck, This is my third day bu
cant figure out how to lock the cells on selection of values from othe
cell

--
tahi

Student, working on a projec
-----------------------------------------------------------------------
tahir's Profile: http://www.excelforum.com/member.php...nfo&userid=605
View this thread: http://www.excelforum.com/showthread.php?threadid=52365


tahir

Macro To Lock Certain Cells... Please Help
 

Please Its Really Getting Hard for me, Please Hel

--
tahi

Student, working on a projec
-----------------------------------------------------------------------
tahir's Profile: http://www.excelforum.com/member.php...nfo&userid=605
View this thread: http://www.excelforum.com/showthread.php?threadid=52365



All times are GMT +1. The time now is 08:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com