Hi all,
I found this code to alternate between two characters (I use it to go around the autofill checkbox problem) it works great except it changes all the cells in the column instead of just the selected cell.
P.S. I'm a real noob in coding, so please be specific
I found this code to alternate between two characters (I use it to go around the autofill checkbox problem) it works great except it changes all the cells in the column instead of just the selected cell.
P.S. I'm a real noob in coding, so please be specific
Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
'Fake checkbox
If Not Intersect(Target, Range("G:G")) Is Nothing Then
If Target.Count > 1 Then Exit Sub
If Target.Value = "¨" Then Target.Value = "=CHAR(254)" Else: Target.Value = "=CHAR(168)"
End If
'Column skip
If Not Intersect(Target, [F:F]) Is Nothing Then
If Target.Count > 1 Then Exit Sub
Static sRg As Range
Dim ColumnOffset As Integer
With Target
Application.EnableEvents = False
If Not sRg Is Nothing Then
If sRg.Column < .Column Then
ColumnOffset = 2
ElseIf .Column <> 1 Then
ColumnOffset = -1
End If
Else
ColumnOffset = 1
End If
.Offset(, ColumnOffset).Select
Application.EnableEvents = True
End With
Set sRg = ActiveCell
End If
End Sub