Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 852
Default For Each c In Range... is slow



try again autofilter:

Sub Test()
Dim LCol As Long, LRow As Long, i As Long
Dim myRng As Range

Application.ScreenUpdating = False

With ActiveSheet
LCol = .Cells(1, Columns.Count).End(xlToLeft).Column
LRow = .Cells(Rows.Count, 1).End(xlUp).Row
Set myRng = .Range(.Cells(1, 1), .Cells(LRow, LCol))

For i = 4 To LCol
myRng.AutoFilter Field:=i, Criteria1:="<"
.Range(.Cells(2, 1), .Cells(LRow, 3)).SpecialCells(xlCellTypeVisible).Copy _
Sheets(.Cells(1, i).Value).Cells(Rows.Count, 1).End(xlUp)(2)
.ShowAllData
Next
End With
Application.ScreenUpdating = True
End Sub


Regards
Claus B.
--


Well, that is a work of art. Autofilter to the rescue again, and of course the excellent knowledge to use it.

Thanks Claus.

Howard
Reply
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
SUMPRODUCT with date range running slow Chipperzs Excel Discussion (Misc queries) 1 January 12th 12 01:09 PM
Range.Find gets slow vbapro Excel Programming 19 April 18th 08 03:05 PM
Looping through Range...Slow Craig M Excel Programming 5 September 7th 06 08:18 AM
Any thoughts - VBA Slow Down with Range.Clear Command Paul Fenton Excel Programming 5 February 17th 06 02:16 PM
Problem with Slow ReCalculation of Dynamic Range Using OFFSET Kris_Wright_77 Excel Worksheet Functions 2 November 18th 05 10:18 AM


All times are GMT +1. The time now is 05:09 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"