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: 852
Default Critique my filter/copy/visiblecells code...

This works pretty good, but seems to me to not be the "proper" use of .VisibleCells.

Where the code looks at all sheets in the array, column E, if the value in E has an "X" in the adjacent column D, then copy E value to sheet 1 column AG next open cell.

Is fairly fast, but only using 20 or so rows on each sheet.

Thanks,
Howard

Sub Many_To_One_Copy_1()

Dim i As Long
Dim MyArr As Variant
Dim lr As Long
Dim rngE As Range, c As Range

MyArr = Array("Sheet2", "Sheet3", "Sheet4", "Sheet5")

Application.ScreenUpdating = False

For i = LBound(MyArr) To UBound(MyArr)

With Sheets(MyArr(i))

.AutoFilterMode = False

lr = .Cells(.Rows.Count, 5).End(xlUp).Row
Set rngE = .Range("$D$1:$E$" & lr)

rngE.AutoFilter Field:=1, Criteria1:="=X"
.Range("$E$2:$E$" & lr).SpecialCells(xlCellTypeVisible).Copy
Sheets("Sheet1").Range("AG" & Rows.Count).End(xlUp)(2).PasteSpecial Paste:=xlPasteValues

rngE.AutoFilter

End With
Next 'i

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
Critique a function to convert time, please Prof Wonmug Excel Programming 2 April 30th 10 04:43 PM
Copy only visible cells after filter is applied/ sum after filter MAM Excel Worksheet Functions 0 April 9th 08 04:09 AM
critique my project Jeff Higgins Excel Programming 2 February 10th 05 01:17 PM
Efficiency in my code (a critique from the guru's) Wally Steadman[_4_] Excel Programming 1 December 30th 04 12:45 PM
The For Loop Worked, but need critique Bruce Roberson Excel Programming 8 August 2nd 03 09:17 AM


All times are GMT +1. The time now is 07:16 AM.

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"