sasi251904
New Member
Hi All, i am sasi kanth. I wanted to copy data of required criteria from one excel sheet to another excel sheet. I have written the Following VBA code how ever there's an error persisting as "1004" Run time error. i am using Excel 2007(the code written is for a command button)can any one please help me on this.
x=2
do while (x,1)<> " "
if (x,4)>=20 then
worksheets("sheet1").rows(x).copy
worksheets("sheet2").activate
erow=activesheet.cells(rows.count,1).end(xlup).offset(1,0)
activesheet.paste destination:=woksheets("sheet2").rows(erow)
endif
worksheets("sheet1").activate
x=x+1
loop
end sub
x=2
do while (x,1)<> " "
if (x,4)>=20 then
worksheets("sheet1").rows(x).copy
worksheets("sheet2").activate
erow=activesheet.cells(rows.count,1).end(xlup).offset(1,0)
activesheet.paste destination:=woksheets("sheet2").rows(erow)
endif
worksheets("sheet1").activate
x=x+1
loop
end sub