ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy cells (https://www.excelbanter.com/excel-programming/396455-copy-cells.html)

AM

copy cells
 
I need to copy cells from one worksheet to
another [same workbook], based on two conditions. The conditions are simple,
e.g. ISBLANK($A30) and $C30="OPEN", etc. The original column has 200 entries.
Only 50 of them may be copied in consecutive cells in a column on the new
worksheet.

Thanks for any help.
Atul


Tom Ogilvy

copy cells
 
Sub CopyData()
Dim rng as Range, sh as worksheet
Dim rw as Long, cell as Range
with worksheets(1)
set rng = .range(.cells(2,1),.cells(2,1).End(xldown))
End with
set sh = Worksheets(2)
rw = 2
for each cell in rng
if len(trim(cell)) = 0 and cell.offset(0,2) = "OPEN" then
cell.Entirerow.copy sh.Cells(rw,1)
rw = rw + 1
end if
Next
End sub
--
Regards,
Tom Ogilvy


"AM" wrote:

I need to copy cells from one worksheet to
another [same workbook], based on two conditions. The conditions are simple,
e.g. ISBLANK($A30) and $C30="OPEN", etc. The original column has 200 entries.
Only 50 of them may be copied in consecutive cells in a column on the new
worksheet.

Thanks for any help.
Atul



All times are GMT +1. The time now is 01:58 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com