This is becoming more than confusing. I am reading from the Book "Excel 2007 Bible".
-
Copying a range
Copying a range is a frequent activity in macros. When you turn on the macro recorder (using absolute recording mode) and copy a range from A1:A5 to B1:B5, you get a VBA macro like this:
Sub CopyRange()
Range(A1:A5).Select
Selection.Copy
Range(B1).Select
ActiveSheet.Paste
Application.CutCopyMode = False
End Sub
Once pasted and run the above recorded macro, that I copied and pasted works fine
From the book: "This macro works, but its not the most efficient way to copy a range. You can accomplish exactly the same result with the following one-line macro:"
''''' The following code fails miserably:
Sub CopyRange2()
Range(A1:A5).Copy Range(B1)
End Sub
Once pasted/typed in to the VBE, the entire line which begins with 'Range', between the 'Sub' and 'End Sub' lines, turns red. Obviously, for me, the code does not do what the author states. Is this code correct or do I have an issue with the VBE?
Allow me to assure you all, my copy and paste skills are second to none. :>)
I'm trying to learn by example(s) supposedly specific to my version of Excel, but when I run it to items such as I am posting here, well; it just takes my breath away. In other words, how the Sam Hill could this happen!
Bookmarks