Phil Hageman
New Member
- Joined
- May 6, 2014
- Messages
- 14
Would appreciate very much if anyone could help with this code. It does not work at all. Also, it needs to work in newly created monthly worksheets - should it be in a module?
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
Dim myRange1 As Range
Dim myRange2 As Range
'MOVE ACTIVE CELL RIGHT ONE CELL IN COLUMNS G, H, I, AND M, N, O.
'Set the range of cells for activation to occur.
Set myRange1 = Range("G3:I52", "M3:O52")
'Test whether the cell changed (Target) is within the the range
If Not Intersect(Target, myRange1) Is Nothing Then
'It is, so switch events off to prevent a double trigger
Application.EnableEvents = False
'Select one cell right (row first number, column second number)
Target.Offset(0, 1).Select
'Switch events back on.
Application.EnableEvents = True
End If
'MOVE ACTIVE CELL ONE ROW DOWN, THREE COLUMNS LEFT.
'Set the range of cells for activation to occur. Columns J amd P only need to go to row 51.
Set myRange2 = Range("J3:J51", "P3:P51")
'Test whether the cell changed (Target) is within the the range.
If Not Intersect(Target, myRange2) Is Nothing Then
'It is, so switch events off events prevent a double trigger
Application.EnableEvents = False
'Select the cell 1 row down and 3 columns left (row is first number, column is second number.
'Down and right are positive, up and left are negative.
Target.Offset(1, -3).Select
'Switch events back on.
Application.EnableEvents = True
End If
End Sub