Logo 
Search:

MS Office Answers

Ask Question   UnAnswered
Home » Forum » MS Office       RSS Feeds
  Question Asked By: Cameron Evans   on Jan 14 In MS Office Category.

  
Question Answered By: Gerald Cruz   on Jan 14

whenever I deal with big  (long) XLS tables I use Filters rather than loops,
which is extremly fast. Additionally, disabling screen updating will
significantly improve execution speed. In your case it looks like the
autofilter's "custom" function (or the advanced filters) should work great.

Here is an extract of some code I use in one of my macros using the custom
autofilter:

Rows(1).Autofilter
Rows(1).Autofilter Field:=TRSC, Criteria1:=">=19", Operator:=xlAnd, _
Criteria2:="<27"
Range(Cells(2, PQAC), Cells(2, PQAC).End(xlDown)).Select
Selection.Replace What:="*", Replacement:="9999999999", LookAt:=xlWhole

This filters the data in column  TRSC for values  between "19" and "27". Then I
select the column PQAC and replace it's value  by number "9999999999". rather
than replacing the value, you could just copy  the selection to a new worksheet.
You may need to select the entire column in your case though.

Share: 

 

This Question has 2 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on looping in excel Or get search suggestion and latest updates.


Tagged: