Hi Kalshaer, Hope you are doing good.
Need your help once again. In the below once selection done in column "U", it will date and time automatically in column "T" and copy the list of info to another workbook. Until that no problem for me.
I need to add lock option. Once any choice is selected in "U"and copied I want the cell needs to be lock to avoid further selection in single cell. Based on below, it is not happening. Pls help.
Private Sub Worksheet_Change(ByVal Target As Excel.Range)
With Target
If .Count > 1 Then Exit Sub
If Not Intersect(Range("U:U"), .Cells) Is Nothing Then
Application.EnableEvents = False
If IsEmpty(.Value) Then
.Offset(0, -1).ClearContents
Else
With .Offset(0, -1)
.NumberFormat = "dd mmm yyyy hh:mm:ss"
.Value = Now
End With
End If
Application.EnableEvents = True
End If
End With
If Target.Column <> 21 Then Exit Sub
If Target.Text = "Approved" Or Target.Text = "Rejected" Or Target.Text = "Hold" Then
Application.ScreenUpdating = False
Dim oSH1 As Worksheet
Set oSH1 = ThisWorkbook.ActiveSheet
Dim wbCallLogs As Workbook
Set wbCallLogs = Workbooks.Open("C:\Rajesh Kanna\Tools\Copy range to different workbook\Data.xls")
Dim oSH As Worksheet
Set oSH = wbCallLogs.Worksheets("Calls")
Dim r As Long
r = oSH.Cells(oSH.Rows.Count, 21).End(xlUp).Row + 1
oSH.Range(r & ":" & r).Value = oSH1.Range(Target.Row & ":" & Target.Row).Value
wbCallLogs.Close (True)
End If
'Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Then Exit Sub
If Not Intersect(Target, Range("t1:t10")) Is Nothing Then 'set your range here
ActiveSheet.Unprotect Password:="123"
Target.Locked = True
ActiveSheet.Protect Password:="123"
End If
End Sub
Bookmarks