View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
joel[_900_] joel[_900_] is offline
external usenet poster
 
Posts: 1
Default Selecting Multiple columns with multiple rows


I don't know why you need to add a row on sheet2. I wrote two similar
macros. the 1st doesn't add the row. The 2nd does insert a new row

Destrow = 1
with Sheets("Sheet1")
For RowCount = 3 to 17
Data = .range("D" & rowcount)
if Data 0 then
.Range("A" & RowCount & ":F" & Rowcount).copy _
Destination:=Sheets("Sheet2").range("A" & DestRow)
DestRow = DestRow + 1
End if
Next Rowcount
end with



2nd macro

Destrow = 2
with Sheets("Sheet1")
For RowCount = 3 to 17
Data = .range("D" & rowcount)
if Data 0 then
Sheets("Sheet2").rows(RowCount + 1).Insert
.Range("A" & RowCount & ":F" & Rowcount).copy _
Destination:=Sheets("Sheet2").range("A" & DestRow)
DestRow = DestRow + 1
End if
Next Rowcount
end with
'Original Source: http://tinyurl.com/y84jecl


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?u=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=194340

http://www.thecodecage.com/forumz