LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sal Sal is offline
external usenet poster
 
Posts: 84
Default Separate


I want to change this part of the macro For Each ws In
ThisWorkbook.Worksheets (I think) so that Sheet2, Sheet3, Sheet4, and Sheet5
will be excluded from the macro below. Can you tell me how I would do that?

Sub Separate ()
Sheets.Add.Name = "C"
Sheets.Add.Name = "I"
Sheets("sheet1").Activate
Range("A1:L1").Copy
Sheets("C").Activate
Range("A1").PasteSpecial
Sheets("I").Activate
Range("A1").PasteSpecial

Dim lr As Long
Dim ws As Worksheet

Application.EnableEvents = False
Application.ScreenUpdating = False
lr = Sheets("sheet1").Range("D" & Rows.Count).End(xlUp).Row
For Each ws In ThisWorkbook.Worksheets
If ws.Name < "sheet1" Then
With Sheets("sheet1").Rows("1:" & lr)
..AutoFilter Field:=4, Criteria1:=ws.Name
..Offset(1).Copy Destination:=ws.Range("A2:L65000")
..AutoFilter
End With
End If
Next ws
Application.EnableEvents = True
Application.ScreenUpdating = True

End Sub

 
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
separate two dates from a text string into two separate cells Tacrier Excel Discussion (Misc queries) 3 October 13th 08 08:53 PM
I wish to separate city, state, and zip into 3 separate columns Bob Woolbert Excel Worksheet Functions 1 July 11th 06 05:29 PM
Open Separate Excel Files in Separate Windows JTWood Excel Discussion (Misc queries) 3 May 7th 06 10:18 PM
Save 2 separate data imports in separate worksheets on the same ex Jay Excel Worksheet Functions 1 March 8th 06 01:31 PM
Open Excel files in separate sessions, not just separate windows? Bob at Dexia Design Excel Discussion (Misc queries) 1 October 18th 05 05:46 PM


All times are GMT +1. The time now is 10:20 PM.

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

About Us

"It's about Microsoft Excel"