Hello all, I've found quite a lot of usefull tips on this forum by just looking around, but I can't seem to find this answer for this problem. Keep in mind that I have next to no knowledge in VBA of coding in general.
I have found two codes that I would like to use simultaneously on the same worksheet, but apparently I can't because they are both SelectionChange codes.
Here are the codes:
Code 1:
Private sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target,Range(“A:1”)) Is Nothing Then
If Target.Count > 1 Then Exit Sub
If Target.Value = “þ” Then Target.Value = “¨” Else: Target.Value = “þ”
End If
End Sub
Code 2:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static sRg As Range
Dim ColumnOffset As Integer
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Union([B:B], [D:D], [F:F])) Is Nothing Then
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
End If
Set sRg = ActiveCell
End Sub
Thanks in advance for anyone who has answers!
I have found two codes that I would like to use simultaneously on the same worksheet, but apparently I can't because they are both SelectionChange codes.
Here are the codes:
Code 1:
Private sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target,Range(“A:1”)) Is Nothing Then
If Target.Count > 1 Then Exit Sub
If Target.Value = “þ” Then Target.Value = “¨” Else: Target.Value = “þ”
End If
End Sub
Code 2:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Static sRg As Range
Dim ColumnOffset As Integer
If Target.Count > 1 Then Exit Sub
If Not Intersect(Target, Union([B:B], [D:D], [F:F])) Is Nothing Then
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
End If
Set sRg = ActiveCell
End Sub
Thanks in advance for anyone who has answers!