ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Absolute/Relative Referencing & Buttons! (https://www.excelbanter.com/excel-programming/330160-absolute-relative-referencing-buttons.html)

Angela

Absolute/Relative Referencing & Buttons!
 
Hello all,
I have a very long spreadsheet where I have recorded a macro to take you
back to a cell reference up near the top of the spreadsheet. This macro is
assigned to a button.
Trouble is, I now need to delete some rows & columns of the spreadsheet and
when I do that the button no longer takes me back to the right cell. If I
delete a row, it takes me to the cell one row above. Same with columns.
Is there some way of amending the code so that it always goes back to that
same cell, even though I delete rows/colums?

Thanks muchly!

Alok

Absolute/Relative Referencing & Buttons!
 
Create a name for the cell - say -CellToGoto
This you do by clicking on the Cell and then typing the above name in the
name box.
Then add this code to go to that cell

application.Goto Range("Celltogoto"),true

Alok Joshi

"Angela" wrote:

Hello all,
I have a very long spreadsheet where I have recorded a macro to take you
back to a cell reference up near the top of the spreadsheet. This macro is
assigned to a button.
Trouble is, I now need to delete some rows & columns of the spreadsheet and
when I do that the button no longer takes me back to the right cell. If I
delete a row, it takes me to the cell one row above. Same with columns.
Is there some way of amending the code so that it always goes back to that
same cell, even though I delete rows/colums?

Thanks muchly!


Angela

Absolute/Relative Referencing & Buttons!
 
Thanks Alok, worked a dream!

Much appreciated.

"Alok" wrote:

Create a name for the cell - say -CellToGoto
This you do by clicking on the Cell and then typing the above name in the
name box.
Then add this code to go to that cell

application.Goto Range("Celltogoto"),true

Alok Joshi

"Angela" wrote:

Hello all,
I have a very long spreadsheet where I have recorded a macro to take you
back to a cell reference up near the top of the spreadsheet. This macro is
assigned to a button.
Trouble is, I now need to delete some rows & columns of the spreadsheet and
when I do that the button no longer takes me back to the right cell. If I
delete a row, it takes me to the cell one row above. Same with columns.
Is there some way of amending the code so that it always goes back to that
same cell, even though I delete rows/colums?

Thanks muchly!



All times are GMT +1. The time now is 02:52 AM.

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