Delorean14
New Member
- Joined
- Apr 4, 2012
- Messages
- 33
Hello, and I'd like to say thank you in advance for helping, if you can. Ok, so the code that I have placed in "ThisWorkbook" of "Microsoft Excel Objects" in the visual basic editor. Here is the code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then
Target.Offset(0, 1).Select
ElseIf Target.Column = 3 Then
Target.Offset(0, 1).Select
ElseIf Target.Column = 4 Then
Target.Offset(2, -2).Select
End If
End Sub
Now, the workbook contains a hidden template sheet that is copied and pasted into a new sheet when a button is pressed to create a new sheet. After which, the code above does not work. I've tried putting the code in the template's object, and it then works in the template, but not in the sheets created from it. Is there a way to copy the code to the new sheet's object, or make ThisWorkbook actually work? This is VERY frustrating! Thanks!
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column = 2 Then
Target.Offset(0, 1).Select
ElseIf Target.Column = 3 Then
Target.Offset(0, 1).Select
ElseIf Target.Column = 4 Then
Target.Offset(2, -2).Select
End If
End Sub
Now, the workbook contains a hidden template sheet that is copied and pasted into a new sheet when a button is pressed to create a new sheet. After which, the code above does not work. I've tried putting the code in the template's object, and it then works in the template, but not in the sheets created from it. Is there a way to copy the code to the new sheet's object, or make ThisWorkbook actually work? This is VERY frustrating! Thanks!