G
GS
For the non read/write directly to ranges approach, make sure the top
of the code window has the following...
Option Explicit
Option Base 1
...and replace CopySheetAndNameCopies() with whichever of the following
you like...
Sub CopySheetAndNameCopies_v2()
Dim vNames, sFormulas, n&, k&
vNames = Sheets("Summary").Range("BreakdownList")
Application.ScreenUpdating = False
Sheets("Main Swb").Visible = True
For n = LBound(vNames) To UBound(vNames)
Sheets("Main Swb").Copy after:=Sheets("Summary")
ActiveSheet.Name = vNames(n, 1)
sFormulas = "='" & vNames(n, 1) & "'!G7"
Sheets("Summary").Range("BreakdownList").Cells(n).Offset(,
1).Resize(1, 4) = sFormulas
Next 'n
Sheets("Main Swb").Visible = False
Application.ScreenUpdating = True
End Sub
Sub CopySheetAndNameCopies_v3()
Dim vNames, vFormulaRefs, vaFormulas(1, 4), n&, k&
vNames = Sheets("Summary").Range("BreakdownList")
vFormulaRefs = Array("G7", "H7", "I7", "J7")
Application.ScreenUpdating = False
Sheets("Main Swb").Visible = True
For n = LBound(vNames) To UBound(vNames)
Sheets("Main Swb").Copy after:=Sheets("Summary")
ActiveSheet.Name = vNames(n, 1)
For k = 1 To 4
vaFormulas(1, k) = "='" & vNames(n, 1) & "'!" & vFormulaRefs(k)
Next 'k
Sheets("Summary").Range("BreakdownList").Cells(n).Offset(,
1).Resize(1, UBound(vaFormulas, 2)) = vaFormulas
Next 'n
Sheets("Main Swb").Visible = False
Application.ScreenUpdating = True
End Sub
...and take care to catch any line wraps. (All code is single lines)
--
Garry
Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion
of the code window has the following...
Option Explicit
Option Base 1
...and replace CopySheetAndNameCopies() with whichever of the following
you like...
Sub CopySheetAndNameCopies_v2()
Dim vNames, sFormulas, n&, k&
vNames = Sheets("Summary").Range("BreakdownList")
Application.ScreenUpdating = False
Sheets("Main Swb").Visible = True
For n = LBound(vNames) To UBound(vNames)
Sheets("Main Swb").Copy after:=Sheets("Summary")
ActiveSheet.Name = vNames(n, 1)
sFormulas = "='" & vNames(n, 1) & "'!G7"
Sheets("Summary").Range("BreakdownList").Cells(n).Offset(,
1).Resize(1, 4) = sFormulas
Next 'n
Sheets("Main Swb").Visible = False
Application.ScreenUpdating = True
End Sub
Sub CopySheetAndNameCopies_v3()
Dim vNames, vFormulaRefs, vaFormulas(1, 4), n&, k&
vNames = Sheets("Summary").Range("BreakdownList")
vFormulaRefs = Array("G7", "H7", "I7", "J7")
Application.ScreenUpdating = False
Sheets("Main Swb").Visible = True
For n = LBound(vNames) To UBound(vNames)
Sheets("Main Swb").Copy after:=Sheets("Summary")
ActiveSheet.Name = vNames(n, 1)
For k = 1 To 4
vaFormulas(1, k) = "='" & vNames(n, 1) & "'!" & vFormulaRefs(k)
Next 'k
Sheets("Summary").Range("BreakdownList").Cells(n).Offset(,
1).Resize(1, UBound(vaFormulas, 2)) = vaFormulas
Next 'n
Sheets("Main Swb").Visible = False
Application.ScreenUpdating = True
End Sub
...and take care to catch any line wraps. (All code is single lines)
--
Garry
Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion