tcarter963
New Member
- Joined
- Aug 3, 2006
- Messages
- 38
I have this code that I was trying to modify to loop through then paste to a new worksheet. I can't seem to get the loop to work. It will work on one sheet and that's it. It isn't a must have, but it would really be nice to be able to copy to a new blank worksheet rather than within the same sheet. I'm using excel 2003 and 2007. One more thing that may be pertinent is that I have graphs as sheets present in the same workbook.
Code:
Option Explicit
Sub CpAveWS()
Dim WS As Worksheet
For Each WS In ActiveWorkbook.Worksheets
Dim LastRowColumnI As Long
Dim LastRowColumnBB As Long
Application.ScreenUpdating = False
LastRowColumnI = Range("I301").End(xlUp).Row
Range("O2:W" & LastRowColumnI).Copy
Range("BB2:BJ" & LastRowColumnI).PasteSpecial (xlPasteValues)
Selection.SpecialCells(xlCellTypeBlanks).Delete (xlShiftUp)
LastRowColumnBB = Range("BB301").End(xlUp).Row
Range("BA2:BA" & LastRowColumnBB).Value = Range("B2").Value
Application.CutCopyMode = False
Application.ScreenUpdating = True
On Error Resume Next
Next WS
End Sub