bobaol
Board Regular
- Joined
- Jun 3, 2002
- Messages
- 225
- Office Version
- 365
- 2003 or older
- Platform
- 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.
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.