Thread: copy and paste
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default copy and paste

Sub copyData()
Dim sh1 as Worksheet, sh2 as Worksheet
Dim rng2 as Range, j as Long, i as Long
set sh1 = worksheets("Sheet1")
set sh2 = worksheets("Sheet2")
set rng2 = sh2.cells(rows.count,1).End(xlup)(2)
j = 1
for i = 1 to 200
if isnumeric(sh1.cells(i,0)) then
if sh1.cells(i,0) 0 then
rng2(j).Value = sh1.cells(i,0).Value
j = j + 1
end if
end if
Next i
End sub

--
Regards,
Tom Ogilvy

"enyaw" wrote:

I am copying over information from Sheet1 to Sheet2. I do subtotals in
Sheet1 but do not know how many items i need to calculate so I leave the
calculation in cell A200. I need to be able to copy over the information
from Sheet1 without copying over the empty rows. I also need to copy over
the value from the calculation. I need to copy over more than one subtotal
so when I am pasting the information into Sheet2 I need the program to search
for the next free row before pasting. Can anyone help me with this?