Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel macro
I would like to extract rows from one sheet and add them to another
sheet if there is the character 's' is in the cell under column k. How do I do this? TIA. -- Posted via a free Usenet account from http://www.teranews.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Excel macro
Sub CopyData()
Dim cell as range, rng1 as Range, rng as range Dim sh as worksheet With worksheets("Sheet1") set rng = .Range(.cells(2,"k"),.cells(2,"k").End(xlup)) End with set sh = worksheets("Sheet2") for each cell in rng if lcase(cell.value) = "s" then if rng1 is nothing then set rng1 = cell else set rng1 = union(rng1,cell) end if end if Next if not rng1 is nothing then rng1.EntireRow.Copy Destination:= _ sh.cells(rows.count,1).end(xlup)(2) End if End sub -- Regards, Tom Ogilvy "Pierre Fichaud" wrote in message .. . I would like to extract rows from one sheet and add them to another sheet if there is the character 's' is in the cell under column k. How do I do this? TIA. -- Posted via a free Usenet account from http://www.teranews.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Call macro stored in Excel workbook from Outlook's macro | Excel Programming | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
translate lotus 1-2-3 macro into excel macro using excel 2000 | Excel Programming | |||
Excel Macro Issue Trying to autorun Macro Upon Opening Worksheet | Excel Programming |