ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Remember a cell (https://www.excelbanter.com/excel-programming/310212-remember-cell.html)

scrabtree[_2_]

Remember a cell
 
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. ???

Ron de Bruin

Remember a cell
 
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


--
Regards Ron de Bruin
http://www.rondebruin.nl


"scrabtree" wrote in message ...
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. ???




Don Guillett[_4_]

Remember a cell
 
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

--
Don Guillett
SalesAid Software

"scrabtree" wrote in message
...
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. ???





All times are GMT +1. The time now is 10:15 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com