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: 23
Default Looping through visible cells

Here is a snippet of working code:

--------------------------------------------------------------------------------------
' change all blank task ids with worktype Release to a lookup based
' on taskname
Selection.AutoFilter Field:=7, Criteria1:="="
Selection.AutoFilter Field:=6, Criteria1:="Release"

firstrow = getfirstrow()
lastrow = getlastrow("F")
Range("G" & firstrow).Select
ActiveCell.Value = "=VLOOKUP($H" & firstrow &
",TaskNameIds.xls!TasknameIdTbl,2,FALSE)"
Selection.Copy
Range("G" & firstrow & ":G" & lastrow).Select
ActiveSheet.Paste
Application.CutCopyMode = False

'Clear the filters and copy in all of G to get the values for the lookups
Selection.AutoFilter Field:=6
Selection.AutoFilter Field:=7
firstrow = getfirstrow()
lastrow = getlastrow("G")

Range("G" & firstrow & ":G" & lastrow).Select
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False

' change all blank task names to the investment names for ID* projects
Selection.AutoFilter Field:=8, Criteria1:="="
Selection.AutoFilter Field:=4, Criteria1:="ID*"
--------------------------------------------------------------------------------------

I am trying to find a way to do it more efficiently. The spreadsheet this
is operating on has about 12000+ rows. I originally tried to copy the
copy/paste special/values on the filtered data. I got an error saying the
copy area and paste area are not the same size and shape. So I cleared the
filter and selected the column from first row to last row and copy/paste
special. It works but it takes a very long time to do as it is operating on
12000+ rows, even though only some of
those rows actually has a formula.

How can I leave the filter on, and step through the range of visible cells
to do the copy/pastespecial? Will that be more efficient/faster?

TIA.


 
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
Copy Visible Cells in Sheet with Merged and Hidden Cells rtwiss Excel Discussion (Misc queries) 5 April 25th 23 09:08 AM
Copy Visible Cells and paste in another workbook visible cells only Abdul[_2_] Excel Programming 5 August 2nd 09 02:08 AM
Looping through Cells Bill Excel Programming 1 March 2nd 06 06:35 PM
Looping through visible rows only Rasmus[_3_] Excel Programming 1 April 10th 05 02:08 AM
Help: Copying Visible Cells only to Visible cells! Jay Jayakumar Excel Programming 0 July 9th 03 08:25 PM


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