Universal_
New member
- Local time
- Today, 16:01
- Joined
- Aug 10, 2023
- Messages
- 7
Afternoon All,
Hope this finds you all well, just having a moment and can't figure out how to code VBA in a way that the whole column on this sheet will make use of it.
This is the code I currently have written.
I know the issue is on this line "If Target.Address = "$K$4" Then"
What can I do to this to incorporate the whole column on this worksheet.
I have two cells ontop as part of a merged cell as a title but don't think that will cause issues.
Looking forward for your help.
All the best
Hope this finds you all well, just having a moment and can't figure out how to code VBA in a way that the whole column on this sheet will make use of it.
This is the code I currently have written.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Oldvalue As String
Dim Newvalue As String
On Error GoTo Exitsub
If Target.Address = "$K$4" Then
If Target.SpecialCells(xlCellTypeAllValidation) Is Nothing Then
GoTo Exitsub
Else: If Target.Value = "" Then GoTo Exitsub Else
Application.EnableEvents = False
Newvalue = Target.Value
Application.Undo
Oldvalue = Target.Value
If Oldvalue = "" Then
Target.Value = Newvalue
Else
If InStr(1, Oldvalue, Newvalue) = 0 Then
Target.Value = Oldvalue & ". " & Newvalue
Else:
Target.Value = Oldvalue
End If
End If
End If
End If
Application.EnableEvents = True
Exitsub:
Application.EnableEvents = True
End Sub
I know the issue is on this line "If Target.Address = "$K$4" Then"
What can I do to this to incorporate the whole column on this worksheet.
I have two cells ontop as part of a merged cell as a title but don't think that will cause issues.
Looking forward for your help.
All the best