Remember a cell

  • Thread starter Thread starter scrabtree
  • Start date Start date
S

scrabtree

When running a code my curser ends up moving. For
example, the active cell was D4 when everything started.
During the running of the code there is cutting and
pasteing etc. At the end of all the activity I need the
code to remember the original cell (D4) and return
there. ???
 
Hi scrabtree

For most things you don't have to select cells.
But you can do this

Sub test()
Dim Srange As Range
Srange = ActiveCell

' your code

Srange.Select
End Sub
 
Not really. You do NOT have to make selections to cut/paste. The following,
as an example can be run from anywhere in the workbook.

sheets("sheet1").range("a1").copy sheets("sheet2").range("a1")
to get just values
sheets("sheet2").range("a1").value=sheets("sheet1").range("a1").value
 

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