Copy and Paste vb recording

bobaol

Board Regular
Joined
Jun 3, 2002
Messages
225
Office Version
  1. 365
  2. 2003 or older
Platform
  1. Windows
hello, i have an odd question.... usually, when i record my macros, it does this thing with copy and paste. it is copy, paste as values, then paste as formats. and it does it the way i want it to do. here is the "good" code Macro16.

Sub Macro16()
Application.Goto Reference:="R1C1"
Application.CutCopyMode = False
Selection.Copy
ActiveCell.Offset(2, 0).Range("A1").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
Selection.PasteSpecial Paste:=xlPasteFormats, Operation:=xlNone, SkipBlanks:=False, Transpose:=False
End Sub


However, in one of my worksheets, it does not capture it that way. it captures it a different way. so, instead of a single action, i have to copy, paste values. then copy again, and paste formats. here is the "bad" code that i do not like Macro39 :

Macro39_()
'
Application.Goto Reference:="R1C1"
Application.Goto Reference:="R69C1"
ActiveCell.Range("A1:K500").Select
Selection.Copy
ActiveCell.Offset(-23, 0).Range("A1").Select
ActiveSheet.PasteSpecial Format:=3, Link:=1, DisplayAsIcon:=False, IconFileName:=False
Application.Goto Reference:="R69C1"
ActiveCell.Range("A1:K500").Select
Selection.Copy
ActiveCell.Offset(-23, 0).Range("A1").Select
ActiveSheet.PasteSpecial Format:=4, Link:=1, DisplayAsIcon:=False, IconFileName:=False
Application.Goto Reference:="R72C1"

end sub


my question.... why does it not copy and paste the same way? i like the way it captures in Macro16, but Macro39 is a two step process. I can work around it, but I am curious as to why this occurs in Macro39. thanks in advance.
 

Excel Facts

VLOOKUP to Left?
Use =VLOOKUP(A2,CHOOSE({1,2},$Z$1:$Z$99,$Y$1:$Y$99),2,False) to lookup Y values to left of Z values.
Why not start writing the code instead of recording it? ;-)

As of now, you already have almost 100 posts on the board, and being registered here for 9 years! :-)

To be honest, I have difficulties understanding some of the codes, just because they are recorded and not written and well-thought.

Please paste code surrounded with
Code:
 tags. Thanks.
 
Upvote 0

Forum statistics

Threads
1,224,587
Messages
6,179,741
Members
452,940
Latest member
rootytrip

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top