Kristal_81;376238 said:
I am trying to find a formula to copy the rows that contain "suzanne" in
column C and "open" in column B to another worksheet...anyone have any
ideas???Formulae can not copy anything, they can display a result, so if your
criteria was met and you had a whole row of formula to do it it could
display the row that meets your criteria, however, if you changed either
suzanne or open then you would lose your results, the only way to
achieve this is with VBA like this, this is standard module code:
Code:
--------------------
Sub find_and_move_suzanne()
Dim rng As Range, MyCell As Range
Set rng = Sheets("Sheet1").Range("C1:C" & Sheets("Sheet1").Range("C" & Rows.Count).End(xlUp).Row)
For Each MyCell In rng.SpecialCells(xlCellTypeVisible)
If LCase(MyCell.Value) = LCase("suzanne") And LCase(MyCell.Offset(0, -1).Value) = LCase("open") Then
MyCell.EntireRow.Copy Destination:=Sheets("Sheet2").Range("A" & Rows.Count).End(xlUp).Offset(1, 0)
End If
Next MyCell
End Sub
--------------------
*How to add and run a Macro*1. *Copy* the macro above pressing
the keys *CTRL+C*
2. Open your workbook
3. Press the keys *ALT+F11* to open the Visual Basic Editor
4. Press the keys *ALT+I* to activate the *Insert menu*
5. *Press M* to insert a *Standard Module*
6. *Paste* the code by pressing the keys *CTRL+V*
7. Make any custom changes to the macro if needed at this time.
8. *Save the Macro* by pressing the keys *CTRL+S*
9. Press the keys *ALT+Q* to exit the Editor, and return to Excel.
*To Run the Macro...*
To run the macro from Excel, open the workbook, and press *ALT+F8* to
display the *Run Macro Dialog*. Double Click the macro's name to *Run*
it.
--
Simon Lloyd
Regards,
Simon Lloyd
'The Code Cage' (
http://www.thecodecage.com)