View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default if a cell is 0, how do I select a range of cells?

Much better

As I understand it, for each non empty cell in columns F:J, copy the
corresponding cells in A:E for that row and the value in the nonempty cell
to sheet2 in their own row.

Dim rw as Long, cell as Range, i as Long
rw = 2
for each cell in Range(Range("A2"),Cells(rows.count,1).end(xlup))
for i = 6 to 10
if Not isempty(cells(cell.row,i)) then
cell.Resize(1,5).copy Destination:=worksheets("Sheet2") _
.Cells(rw,1)
cells(cell.row,i).copy Destination:=worksheets("Sheet2") _
.Cells(rw,6)
rw = rw + 1
end if
Next i
Next

--
Regards,
Tom Ogilvy



"Angela0212 " <<Ang
wrote in message
...
Okay, let me try again.

I have a spreadsheet. There are 10 columns. I am trying to move only
parts to a second sheet.
The first 5 columns are mandatory. The next 5 columns may or may not
have a dollar amount in them. So for one row, I could have 5 dollar
amounts for one description (the first 5 columns).
So what I am trying to do is break it down line by line. Say the first
non mandatory column has $10, what I need is to be able to have the
mandatory codes copy to another sheet along with the dollar amount.
Then the second non mandatory column could have a $$ amount in it and I
want it to pull the mandatory columns and that dollar amount but not
the first.
Does that make more sense?


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