Hello everybody!
I got some amazing help last time I posted, so I'll give it another go.
I'm still very new to coding in excel and find myself stuck with a Run-time error yet again.
This is the code I'm working with:
Basically, when I enter an SLT-value into a cell, I want the cell 4 steps to the left to automatically enter a reply. The reply should also disappear if the SLT-value is removed.
The code generally works as intended but if I delete rows, enter rows or try to drag fill my SLT value into more cells I recieve a "Run-time error '13': Type mismatch" message.
I'm sure there are many things that could be improved with my code. Any takers?
Best regards
/Alexander
I got some amazing help last time I posted, so I'll give it another go.
I'm still very new to coding in excel and find myself stuck with a Run-time error yet again.
This is the code I'm working with:
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim n As Long
If Not Intersect(Target, Range("G:J")) Is Nothing Then
If InStr(1, Target, "SLT003", vbTextCompare) Then
Target.Offset(0, -4) = "reply 1"
Else
Target.Offset(0, -4) = ""
End If
If InStr(1, Target, "SLT004", vbTextCompare) Then
Target.Offset(0, -4) = "Reply 1"
End If
End If
End Sub
Basically, when I enter an SLT-value into a cell, I want the cell 4 steps to the left to automatically enter a reply. The reply should also disappear if the SLT-value is removed.
The code generally works as intended but if I delete rows, enter rows or try to drag fill my SLT value into more cells I recieve a "Run-time error '13': Type mismatch" message.
I'm sure there are many things that could be improved with my code. Any takers?
Best regards
/Alexander