ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Writing Macro - How to get the cursor/Active Cell back to top of W (https://www.excelbanter.com/excel-programming/323426-writing-macro-how-get-cursor-active-cell-back-top-w.html)

Michele.Nextel

Writing Macro - How to get the cursor/Active Cell back to top of W
 
I'm creating a macro that's a basic zero out of all unprotected cells.
However, I want the macro to return the active cell/window view back to the
top of the sheet once the macro is finished running. What is the command I
put at the end of the macro? Currently, I have this:

Private Sub CommandButton3_Click()

Application.ScreenUpdating = False
ActiveCell.FormulaR1C1 = "0"
Range("K109").Select
ActiveCell.FormulaR1C1 = "0"
Range("K126").Select

End Sub

Thanks! Michele S.

Ed

Writing Macro - How to get the cursor/Active Cell back to top of W
 
Why not just Range("cellattop").Select? ("cellattop" is of course whichever
cell you mean when you say "top of the sheet" = K1, A1, or other)

Ed

"Michele.Nextel" wrote in message
...
I'm creating a macro that's a basic zero out of all unprotected cells.
However, I want the macro to return the active cell/window view back to

the
top of the sheet once the macro is finished running. What is the command

I
put at the end of the macro? Currently, I have this:

Private Sub CommandButton3_Click()

Application.ScreenUpdating = False
ActiveCell.FormulaR1C1 = "0"
Range("K109").Select
ActiveCell.FormulaR1C1 = "0"
Range("K126").Select

End Sub

Thanks! Michele S.





All times are GMT +1. The time now is 03:13 PM.

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