Pls help me for data transfer from 1 file to other file?

G

Guest

Hi to all
I have 2(two) file. 1 is jobdata.xls and 2 is jobover.xls

What i do is when my work is over for jobdata file i cut some rows and
tranfer to jobover files.

Is there any way can i do, it will ask me rows no. and which ever row i enter
it should automatically transfer to jobover file even jobover file is not
open.

and next time it should go below next row in jobover file.

Is this Possible.
Any Help

thanks
 
G

Guest

Sub copyData()
dim rng as Range, rng1 as Range
dim sh as Worksheet, bk as Workbook
dim bBkOpen as Boolean
set sh = Activesheet
if lcase(sh.parent.name) <> "jobdata.xls" then
msgbox "Activate Job sheet"
exit sub
End if
Application.ScreenUpdating = False
On Error Resume Next
set bk = Workbooks("jobover.xls")
On Error goto 0
if bk is nothing then
set bk = Workbooks.Open("C:\Myfolder\jobover.xls")
Else
bBkOpen = True
end if
set rng1 = bk.worksheets(1).Cells(rows.count,1).End(xlup)(2)
sh.Activate
Application.ScreenUpdating = True
On Error Resume Next
set rng = application.Inputbox("Use Mouse to select rows to copy", _
Type:=8)
On Error goto 0
if rng is nothing then
bk.close Savechanges:=False
exit sub
Endif
rng.Entirerow.copy Destination:=rng1
if not bBkOpen then
bk.close Savechanges:=True
else
bk.Save
End if
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top