I have a workbook that has four 'system' sheets and each system sheet has a dynamic number or subsequent tabs used for various data collection. What I need is a way to sort the systems and their children sheets in alphabetical order but existing between two specific sheets. Example:
[Intro/Reference Sheet] [Customer info Sheet] [System 1] [Sys1 Child 1-12] [System 2] [Sys2 Child 1-12] [System 3] [Sys3 Child 1-12] [System 4] [Sys4 1-12] [Other sheets]
I've tried sorting subs such as
For Each w1 In Sheets
For Each w2 In Sheets
If w1.Range("Z1") <> "" And w2.Range("Z1") <> "" Then
If w2.Range("Z1").Value < w1.Range("Z1").Value Then
If w2.Range("Z1").Value = "S1L0" Then
w2.Move after:=Cover
Else
w2.Move before:=w1
End If
End If
End If
Next w2
Next w1
It starts to work great but then the loop gets out of hand and I have the one sheet with "S1L0" in the target range where it should be and everything else is at the end of the list. Any ideas on how I can get this to work?
EDIT: The system sheets all begin with "S1" to "S4" but they get renamed to "S1 - %string%" to "S4 - %string%", the children sheet are copies of a hidden sheet that are named initially "S#L#" where the # is the system and the child number respectively. the children sheets can also be renamed but it will follow the pattern "S#L# - %string%"