copy

R

ranjan.khan

Hi,

I am working with 2 workbooks.

I want to copy contents in ColJ from WKBK2 to ColF in WKBK5.

My content contains a lot of text.

Sub CopyAndPaste()
Dim Src, dest

Set Src = Workbooks("WKBK5.xls").Sheets("Sheet1")
Set dest = Workbooks("WKBK2.xls").Sheets("Sheet1")

i = 2
While Src.Cells(i, 1) <> ""
dest.Cells(i, 6) = Src.Cells(i, 10)
i = i + 1
Wend


I get a Runtime Error '1004'

Why?
 
G

Guest

Ranjan,
Have you thought about linking the two workbooks?
Open both files in excel, minimize both so that both workbooks can sit
side-by-side in the excel frame.
In WKBK5 Column F the first cell that you want to use(F1) type "=" & select
the cell in columnJ in WKBK2 that is the source. Continue with the next cell
in WKBK5 and WKBK2 until complete. This way if numbers are changed in WKBK2
they will automatically change in WKBK5.
Good luck,Hth
Dennis
 
A

Anthony Gaston

Ranjan.Khan,

You could use the following to accomplish this.

=[filename.xls]sheetname!$d$24

The first section is obvious although I should point out that the brackets
establish the file name and the $ give you absolute cell reference. Good
luck.

--
Thanks,

Anthony Gaston
(e-mail address removed)
University of Phoenix
"Raise your role in life above your fear of an un-rewarded purpose." AGaston
 

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