sdohertyccb
Board Regular
- Joined
- Feb 15, 2005
- Messages
- 91
I have a program that creates a dashboard for each saleman in the organization. I use the following code to MOVE the sheet then copy and paste the data. It works great until the 11th salesman, then it quits. The sheet I am copying has 12 charts, so after 10 copies the workbook has 120 charts. Is there a limit? Is there a workaround?
Code:
For x = 0 To offcr_cnt Step 1
officer = Range("offcr_data").Offset(x, 0)
Sheets("ln_templ").Activate
Range("offcr_code") = officer
ActiveSheet.Calculate
Sheetcnt = ActiveWorkbook.Worksheets.Count
Sheets("ln_templ").Copy After:=Sheets(Sheetcnt)
ActiveSheet.name = officer
Cells.Select
Selection.Copy
Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues 'errors out on this line after 11 interations
ActiveSheet.Outline.ShowLevels RowLevels:=0, ColumnLevels:=1
Application.CutCopyMode = False
With ActiveWindow
.DisplayGridlines = False
.DisplayHeadings = False
.DisplayOutline = False
End With
Range("A1").Select
Next x