ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   please help me with my looping of copy worksheets (https://www.excelbanter.com/excel-programming/364697-please-help-me-my-looping-copy-worksheets.html)

funkymonkUK[_187_]

please help me with my looping of copy worksheets
 

hi I have the following code


Code:
--------------------
Sub Config()
' Setup workbook for area to use
' noStores = the number of stores in an area
' Temp Sheet = Template for Stores Data
' Menu Sheet = Main Sheet for Areas to complete

Dim noStores As Integer

noStores = Range("noStores").Value

' Show Stores to enter in their names
Rows("12:33").EntireRow.Hidden = False
For Each cell In Sheets("menu").Range("A13:A32")
If cell.Value noStores Then
cell.EntireRow.Hidden = True
End If
Next


' Copy the correct amount of worksheets per store.

' Sheets("temp").Visible = True
For i = 1 To noStores
Sheets("Temp").Copy After:=Sheets(Sheets.Count)
Sheets("Temp (2)").Name = "Store " & i
Range("f3").Value = "=store_" & i
Next
' Sheets("temp").Visible = False

' Sheets("Menu").Range("a1").Activate



End Sub

--------------------


I have a problem when I am copying the template sheet I refer to the
line "Sheets("Temp").Copy After:=Sheets(Sheets.Count)" it copys the
sheet however it seems to break the loop and end the sub for no
apparent reason.

Any ideas where i might be going wrong?


--
funkymonkUK
------------------------------------------------------------------------
funkymonkUK's Profile: http://www.excelforum.com/member.php...o&userid=18135
View this thread: http://www.excelforum.com/showthread...hreadid=553256



All times are GMT +1. The time now is 12:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com