LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Select specific worksheets & copy - code problem

Hi All
I've tried to write the following code to:
- find worksheets in active workbook with "Planned" in cell A1,
- then select all those worksheets and copy them into one new workbook
- then format each sheet within the new workbook (e.g. select a named range
& copy/paste values etc)

The workbook and worksheet names are dynamic

I'm sure I've got the "End If"'s / "Next" in the wrong place (this always
confuses me)
At the moment it copies the active worksheet (which does not have "Planned"
in cell A1) and a blank new worksheet? - and then it stops.
Any help would be greatly appreciated

Sub Selectplanned()
Dim sh As Worksheet
Dim Rng As Range
Application.ScreenUpdating = False
Application.EnableEvents = False

For Each sh In ActiveWorkbook.Worksheets
If sh.Name < "Overview Template" And sh.Name < "GRP Wkly Collection"_
And sh.Name < "GRP Qtrly Collection" And sh.Visible = True Then

On Error Resume Next
Set Rng = sh.Range("A1") = "Planned"
On Error GoTo 0
If Rng Is Nothing Then
Else
Sheets.Select
End If
End If
Next sh
ActiveWindow.SelectedSheets.Copy

For Each sh In ActiveWorkbook.Worksheets
Application.Goto Reference:="Plannedrange"
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Application.Goto Reference:="GRPpost"
Selection.Copy
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
'etc. etc.
Next sh
End Sub

--
BeSmart
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Select specific sheets and copy to new workbook jeremiah Excel Programming 2 January 28th 09 04:08 PM
Select any row, copy data from specific columns TexWolf Excel Programming 2 August 3rd 07 09:12 PM
select specific cells and consolidate same over many worksheets MikeR-Oz New Users to Excel 2 March 18th 06 01:27 PM
find specific data in row and select and copy entirerow Junior728 Excel Programming 3 August 8th 05 01:31 PM


All times are GMT +1. The time now is 12:44 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"