- Joined
- Sep 20, 2009
- Messages
- 47
- Reaction score
- 2
I am trying to copy non adjacent cells in my excel 2002(windows xp) in a macro.
in an experiment the code statement
Range("A1:F1,I1,K1").Copy works and no error. But I have to use variables instead of A1,F1 etc . My code statement reads
(J is the row nummber)
Range(Range(Cells(j, "A"), Cells(j, "F")), Cells(j, "W"), c, Range("B1")).Copy
gives compile error on the first word "Range" , the error message being "wrong number of arguments or invalid property assignment".
union (Range(Cells(j, "A"), Cells(j, "F")), Cells(j, "W"), c, Range("B1")).Copy
also gives runtime error
what is the mistake I am doing and also how to copy paste non adjacent cells in excel 2002. thanks
in an experiment the code statement
Range("A1:F1,I1,K1").Copy works and no error. But I have to use variables instead of A1,F1 etc . My code statement reads
(J is the row nummber)
Range(Range(Cells(j, "A"), Cells(j, "F")), Cells(j, "W"), c, Range("B1")).Copy
gives compile error on the first word "Range" , the error message being "wrong number of arguments or invalid property assignment".
union (Range(Cells(j, "A"), Cells(j, "F")), Cells(j, "W"), c, Range("B1")).Copy
also gives runtime error
what is the mistake I am doing and also how to copy paste non adjacent cells in excel 2002. thanks
Last edited: