Help! What's wrong with this simple copy and paste

  • Thread starter Thread starter Richard James
  • Start date Start date
R

Richard James

This copy and paste does not work with my userform,
however it directly copied out of a macro I did.

Any help will be appreciated!

Worksheets("Report").Range("D48").Select
Selection.Copy
Sheets("Inputs").Select
Range("M16").Select
Selection.PasteSpecial Paste:=xlValues,
Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
 
It worked for me with xl2000 when used as a Commandbutton
click event. However, I would suggest greatly simplifying
it by not doing all that selecting. Also forget the copy
and paste. Try this simple code instead:

Sheets("Inputs").Range("M1") = Sheets("Report").Range("D1")
 
Sheets("Inputs").Range("M1") = Sheets("Report").Range("D1")
works fine for ONE value but if multiple values the range sizes must match
and you need to use .value at the end of the source range. See example
below.

Sub copyover()
Sheets("Sheet10").Range("d15:d17") = Sheets("sheet8").Range("e12:e14").Value
'or
'[Sheet10!d15:d17] = [sheet8!e12:e14].Value
End Sub
 
Further, if your range is not a single cell, you can use the copy method:
Sheets("Inputs").Range("M1:AZ41") .copy destination: ...
 
Tim,
OP said values so copy would copy formula if data was a formula
 

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

Back
Top