We help IT Professionals succeed at work.
Get Started

I have a macro which copy incorrectly the field from one cell to another, excel 2007

gvilbis
gvilbis asked
on
194 Views
Last Modified: 2012-05-10
on one file i have sum function on it and its not copy correctly the content inside it to another file

the value in original file cell is like:
=SUM(FE89,,FS89,GG89,,GU89,HI89,HW89)

in the copy file cell i am getting like:
=SUM(#REF!,,#REF!,#REF!,,#REF!,#REF!,G3)

the code of copy in the macro is as follow:

 If wksDest.Range("IG" & rng.Row) <> "c" Then 'check if line is completed if yes move to next
               wksDest.Range(Cells(rng.Row, 1), Cells(rng.Row, 9)).Copy
               wksSource.Activate
'               lastRow = Range("A" & rng2.Rows.Count).End(xlUp).Row
               lastRow = Range("A" & Rows.Count).End(xlUp).Row
               Cells(lastRow + 1, 1).PasteSpecial xlPasteAll, Paste:=xlPasteCommens


what is wrong in the copy and paste command?

thanks in advance
Comment
Watch Question
This problem has been solved!
Unlock 1 Answer and 13 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE