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 Find and print in new sheet

Sub ABCD()
Dim k as Long, cell as Range, rng as Range
k = 1
set rng = Worksheets("Sheet2").Range("A1")
with worksheets("sheet1")
for each cell in .Range("A1:A20")
if cell.Value = 1 then
rng(k,1) = cell.offset(0,1)
rng(k,2) = cell.offset(0,3)
k = k + 1
end if
Next
End with
End Sub


--
Regards,
Tom Ogilvy

"SajberSmurf" wrote in message
...
I want to make an function that looks for an number in one worksheet and

copy
it in a new worksheet. like IF(A1=2;"testing";"0") but i dont want it to
write 0 or leave the line empty and jump down,
For exampel if a1= 1 then write b1 and d1
If a2=2 dont write anything but find next 1 and write that on next row in
new worksheet.