turtle_solver
Board Regular
- Joined
- Mar 31, 2006
- Messages
- 71
I would like to get more knowledgable on the code I am using. Would someone be able to go through the code posted below?
Code:
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Excel.Range)
Dim arrayOfNames As Variant
Dim rangeChanged As Range, oneArea As Range
Select Case False
Case (Application.Intersect(Target, Sh.Range("C3")) Is Nothing)
arrayOfNames = Array("Overall", "Sales", "Units", "Spend")
Set rangeChanged = Application.Intersect(Target, Sh.Range("C3"))
Case (Application.Intersect(Target, Sh.Range("C5")) Is Nothing)
arrayOfNames = Array("Overall", "Sales", "Units", "Spend")
Set rangeChanged = Application.Intersect(Target, Sh.Range("C5"))
Case (Application.Intersect(Target, Sh.Range("F3")) Is Nothing)
arrayOfNames = Array("Sales", "Units", "Spend")
Set rangeChanged = Application.Intersect(Target, Sh.Range("F3"))
End Select
On Error GoTo ResetEvents
If IsNumeric(Application.Match(Sh.Name, arrayOfNames, 0)) Then
If Not rangeChanged Is Nothing Then
Application.EnableEvents = False
For Each oneArea In rangeChanged.Areas
Sheets(arrayOfNames).FillAcrossSheets oneArea
Next oneArea
End If
End If
ResetEvents:
Application.EnableEvents = True
On Error GoTo 0
End Sub