Hello
Can you please assist with correcting the below VBA code as i am getting an error on the text in yellow-"Run-time error '13': Type mismatch." .Really appreciate any help here. Thanks in advance. Can you also provide full code solution as i am a novice when it comes to VBA
Note that Changes is my Worksheet name
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C6:X999")) Is Nothing And Range("C" & Target.Row).Value <> Empty Then
If Changes.Range("H2").Value) = Target.Value Then Exit Sub
Dim ChngRow As Long
With Changes
ChngRow = .Range("A99999").End(xlUp).Row + 1
.Range("A" & ChngRow).Value = Now
.Range("B" & ChngRow).Value = ThisWorkbook.BuiltinDocumentProperties("Last Author")
.Range("C" & ChngRow).Value = ActiveSheet.Name
.Range("D" & ChngRow).Value = Target Address
.Range("E" & ChngRow).Value = .Range("H2").value
.Range("F" & ChngRow).Value = Target.Value
End With
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("C6:X999")) Is Nothing And Range("C" & Target.Row).Value <> Empty Then
Changes.Range("H2").Value = Target.Value
End If
End Sub
Basically what im doing is creating a User log history (Got a data input sheet where the above code is used) and then whenever a user makes changes to any cells in the data input sheet, these changes are showed in the Changes sheet name under the below columns
.Range("A" & ChngRow).Value = Now 'Changes the date and Time
.Range("B" & ChngRow).Value = ThisWorkbook.BuiltinDocumentProperties("Last Author") 'User
.Range("C" & ChngRow).Value = ActiveSheet.Name 'Sheet
.Range("D" & ChngRow).Value = Target Address 'Cell
.Range("E" & ChngRow).Value = .Range("H2").value 'Old Value
.Range("F" & ChngRow).Value = Target.Value 'New Value
H2 in Changes Sheet is the selected range
Can you please assist with correcting the below VBA code as i am getting an error on the text in yellow-"Run-time error '13': Type mismatch." .Really appreciate any help here. Thanks in advance. Can you also provide full code solution as i am a novice when it comes to VBA
Note that Changes is my Worksheet name
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C6:X999")) Is Nothing And Range("C" & Target.Row).Value <> Empty Then
If Changes.Range("H2").Value) = Target.Value Then Exit Sub
Dim ChngRow As Long
With Changes
ChngRow = .Range("A99999").End(xlUp).Row + 1
.Range("A" & ChngRow).Value = Now
.Range("B" & ChngRow).Value = ThisWorkbook.BuiltinDocumentProperties("Last Author")
.Range("C" & ChngRow).Value = ActiveSheet.Name
.Range("D" & ChngRow).Value = Target Address
.Range("E" & ChngRow).Value = .Range("H2").value
.Range("F" & ChngRow).Value = Target.Value
End With
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("C6:X999")) Is Nothing And Range("C" & Target.Row).Value <> Empty Then
Changes.Range("H2").Value = Target.Value
End If
End Sub
Basically what im doing is creating a User log history (Got a data input sheet where the above code is used) and then whenever a user makes changes to any cells in the data input sheet, these changes are showed in the Changes sheet name under the below columns
.Range("A" & ChngRow).Value = Now 'Changes the date and Time
.Range("B" & ChngRow).Value = ThisWorkbook.BuiltinDocumentProperties("Last Author") 'User
.Range("C" & ChngRow).Value = ActiveSheet.Name 'Sheet
.Range("D" & ChngRow).Value = Target Address 'Cell
.Range("E" & ChngRow).Value = .Range("H2").value 'Old Value
.Range("F" & ChngRow).Value = Target.Value 'New Value
H2 in Changes Sheet is the selected range