View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Max Max is offline
external usenet poster
 
Posts: 9,221
Default macro to copy and paste based on a condition

.. Basically I have a list of employees with information
about them and a drop down list to retain or terminate.
I need to automatically copy all of the information onto a
separate sheet for anyone who is selected as a term.


How about a simple formulas set-up which accomplishes the above?

Assume source data in Sheet1, cols A to E, data from row2 down, where the DV
statuses (eg: term) are running in B2 down

In another sheet,
The status will be input in A1, eg: term

In B2:
=IF($A$1="","",IF(Sheet1!B2=$A$1,ROW(),""))
Leave B1 empty

In C2:
=IF(ROWS($1:1)COUNT($B:$B),"",INDEX(Sheet1!A:A,SM ALL($B:$B,ROWS($1:1))))
Copy C2 across by as many cols as you have in Sheet1, ie to G2. Then select
B2:G2, fill down to cover the max expected extent of data in Sheet1, eg down
to row 200? Minimize/hide col B. Cols C to E will return the required results
all neatly packed at the top, and dynamic to the status which is input in A1,
and to the data entered in Sheet1.
--
Max
Singapore
http://savefile.com/projects/236895
Downloads:19,000 Files:362 Subscribers:61
xdemechanik
---