As you have learned from this thread, there are many ways to achieve similar results.
Because I learned (and will continue to learn) from here and like to help, I would offer these additional notes.
Range().Select is great and I find most useful if I am about to use that selection to perform another task. If I am just jumping around or wanting general navigation, I prefer: (Assumes you would like to go to Range("A10"):
Application.Goto Range("A10"), True
where "True" represents a scroll such that the selected cell will be the upper left most cell on the visible sheet. "False" would leave the cells position as is regardless of where it is on the screen.
If you were to create a named range of "A10", say, MyRange, both of the following would accomplish the same as the above:
Application.Goto Range("MyRange"), True
&
Application.Goto Reference:="MyRange", Scroll:=True
Building on John's code, you could bundle all three close out tasks nicely within a With End With construct. Something like:
Sub Button1_Click()
Application.ScreenUpdating = False ' or 0
Range("D5").Copy
Range("R5").End(xlDown).Offset(1, 0).PasteSpecial Paste:=xlValues, Operation:=xlNone, _
SkipBlanks:=False, Transpose:=False
With Application
.CutCopyMode = False ' or 0
.ScreenUpdating = True ' or 1
.Goto Range("A10"), True ' or false
End With
ActiveWorkbook.Save
End Sub
If you stay with it, you will see that most guru's advise against .activate and .select unless absolutely necessary. There are reasons that you can google ad nauseum, but that's why you appreciated the simplicity of Roy's offering when you saw it. It does not select, copy, or paste like the macro recorder did for you initially. Much cleaner. Much faster.
Bookmarks