0

I am trying to copy the data from one worksheet and paste it in another worksheet. But it is not working and asking me to use "A1" or R1C1. But I need to start the pasting from cell A5.

This is the code -

 Range("A5:C9").PasteSpecial

Kindly share your thoughts. Thanks.

  • 1
    Do you just need the data? Or are you trying to keep the formulas? If trying to keep the formulas, do you want it *exactly* as is from copy range, or move the formulas relative? Also, is that all the code? Can you please include the other relevant parts, like the `.Copy` line too? – BruceWayne May 18 '17 at 21:17
  • just the data sir ! tried paste values but that didn't help as well – Student of the Digital World May 18 '17 at 21:18
  • 2
    Did you try `Range("A5").PasteSpecial` ? You only need to specify the cell in the top-left corner.Other than that, you have code that cancels the copy operation before you try to pastespecial. Since you decided it was not important enough to include, you are pretty much on your own. –  May 18 '17 at 21:18
  • `Range("A5").PasteSpecial Paste:=xlPasteFormats` See here http://stackoverflow.com/a/34886033/4539709 – 0m3r May 18 '17 at 21:19
  • i tried Range("A5").PasteSpecial and it didn't help too – Student of the Digital World May 18 '17 at 21:20
  • Point 1 of [What topics can I ask about here?](http://stackoverflow.com/help/on-topic) says "Questions seeking debugging help ("why isn't this code working?") must include the desired behavior, a specific problem or error **and the shortest code necessary to reproduce it** in the question itself. Questions without a clear problem statement are not useful to other readers." If that one line is the only code required to reproduce your issue, then it definitely is not going to work - you need to do some sort of `Copy` first! – YowE3K May 18 '17 at 21:48
  • @YowE3K Sorry Sir. But I thought if I put in what error message am getting it will be enough, which I have done in my question my saying - it is asking me to use "A1" or R1C1. But failed to highlight the part. Thanks I will keep in my mind. – Student of the Digital World May 18 '17 at 22:00
  • That also is an interesting point - what is the exact error message you are getting? I doubt if it is just `use "A1" or R1C1`, and I've never seen a message similar to that. – YowE3K May 18 '17 at 22:06
  • @YowE3K I will add the Screenshot when i go to work tomorrow sir. Just to clarify things. Thanks – Student of the Digital World May 19 '17 at 01:05
  • @Sid29 - thanks - my aim in life is to make so many mistakes that I generate every possible Excel error message, so it intrigues me when I hear of one that I haven't accidentally produced before :D – YowE3K May 19 '17 at 02:19

1 Answers1

1

If you just need to paste the data from one worksheet to another, you can skip PasteSpecial (well, .Copy altogether) and just set the two ranges equal to another.

Worksheets("DESTworksheet").Range([DESTINATION range]).Value = Worksheets("ORIGINworksheet").Range([COPY range]).Value

So, try:

Worksheets("DestinationSheet").Range("A5:C9").Value = Worksheets("CopyFromSheet").Range("A5:C9").Value

Of course changing the worksheet names (and/or ranges) as necessary.

BruceWayne
  • 22,923
  • 15
  • 65
  • 110