ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Update VB refs on insert cells (https://www.excelbanter.com/excel-programming/336769-update-vbulletin-refs-insert-cells.html)

Defoes Right Boot

Update VB refs on insert cells
 
Hi

This may be simply down to the settings on my computer, but if I insert new
cells to a worksheet which results in certain cells reference changing (eg if
I insert a new column A, then all the cells previously in column A are now in
column B) my macros do not update the reference, which means when I do
anything like that I have to manually go through the macro and change all the
references which is very time consuming and irritating.

Is there a simple setting I can change to avoid this?

Thanks

Phil

Norman Jones

Update VB refs on insert cells
 
Hi Defoes Fight Boot,

This is a problem with hardcoded ranges.

It would be preferable to define ranges dynamically in your code or to use
named ranges.


---
Regards,
Norman



"Defoes Right Boot" wrote in
message ...
Hi

This may be simply down to the settings on my computer, but if I insert
new
cells to a worksheet which results in certain cells reference changing (eg
if
I insert a new column A, then all the cells previously in column A are now
in
column B) my macros do not update the reference, which means when I do
anything like that I have to manually go through the macro and change all
the
references which is very time consuming and irritating.

Is there a simple setting I can change to avoid this?

Thanks

Phil





All times are GMT +1. The time now is 05:13 AM.

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