View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Copy columns if cell row has a value

Dim rng as Range, rw as long, dest as Range
Dim cell as Range
with Activesheet
set rng = Intersect(.columns(1),.usedrange).Cells
End with
set dest = workbooks("Otherbook.xls").Worksheets(1).Range("A1 ")
rw = 0
for each cell in rng
if cell.offset(0,3) < "" and cell.offset(0,2)="Active" then
rw = rw + 1
cell.Range("A1,A4,A5,A7,A10").copy Destination:=dest(rw)
End if
Next

--
Regards,
Tom Ogilvy

"christian " wrote in message
...
* Need to read each row in a spreasheet (number of rows in the
spreadsheet will always be changing)

* if there is a value in Cells(i, 4) and
the text in Cells(i, 3) = 'Active'

I want to copy columns 1,4,5,7,10 to a new workbook. [one or more rows
makes up one record - the value in column 4 signifies a new record]

* This new spreadsheet will be turned into a CSV to feed another
program.


How would you approach this?
Any help is appreciated!!
thanks
-christian


---
Message posted from http://www.ExcelForum.com/