When opening a workbook for the first time I receive the following Run time Error 1004, Select method of Range Class Failed. Anyone have a suggestion what may be causing this error? My code is below. Any suggestions would be helpful and appreciated. Glad to upload the workbook, if needed, just tell me how. Thank you for your consideration and help.
Dim aTabOrd As Variant
Dim iTab As Long
Dim nTab As Long
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iNew As Long
If IsEmpty(aTabOrd) Then
aTabOrd = Array("C3", "C5", "C7", "G7", "C9", "F15", "L3", "L5", "L7", "M11", "J13", "C11", "E16", "H18", "F20", "I20", "G22", "G24", "M27", "H27", "H29", "H31", "H33", "H39", "H41", "H43", "H45", "H47", "H49", "G51", "H51", "H53")
nTab = UBound(aTabOrd) + 1
iTab = 0
Else
On Error Resume Next
iNew = WorksheetFunction.Match(Target(1, 1).Address(False, False), aTabOrd, 0) - 1
If Err Then
iTab = (iTab + 1) Mod nTab
Else
iTab = iNew
End If
On Error GoTo 0
End If
Application.EnableEvents = False
Range(aTabOrd(iTab)).Select
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("C11")) Is Nothing Then
Application.EnableEvents = False
Range("C11").Value = Range("L9").Value + Range("C11").Value
Application.EnableEvents = True
End If
If Intersect(Target, Range("H18, G51")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target.Value > 0 Then Target = Target.Value * -1
End Sub
Dim aTabOrd As Variant
Dim iTab As Long
Dim nTab As Long
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim iNew As Long
If IsEmpty(aTabOrd) Then
aTabOrd = Array("C3", "C5", "C7", "G7", "C9", "F15", "L3", "L5", "L7", "M11", "J13", "C11", "E16", "H18", "F20", "I20", "G22", "G24", "M27", "H27", "H29", "H31", "H33", "H39", "H41", "H43", "H45", "H47", "H49", "G51", "H51", "H53")
nTab = UBound(aTabOrd) + 1
iTab = 0
Else
On Error Resume Next
iNew = WorksheetFunction.Match(Target(1, 1).Address(False, False), aTabOrd, 0) - 1
If Err Then
iTab = (iTab + 1) Mod nTab
Else
iTab = iNew
End If
On Error GoTo 0
End If
Application.EnableEvents = False
Range(aTabOrd(iTab)).Select
Application.EnableEvents = True
End Sub
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.Count > 1 Or IsEmpty(Target) Then Exit Sub
If Not Intersect(Target, Range("C11")) Is Nothing Then
Application.EnableEvents = False
Range("C11").Value = Range("L9").Value + Range("C11").Value
Application.EnableEvents = True
End If
If Intersect(Target, Range("H18, G51")) Is Nothing Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Target.Value > 0 Then Target = Target.Value * -1
End Sub