ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Visual Basic 6.5 in Excel (https://www.excelbanter.com/excel-programming/406717-visual-basic-6-5-excel.html)

mrogge2895

Visual Basic 6.5 in Excel
 
When modiifying a macro recorded in excel, is there a way to program the code
to automatically recognize changes made within sheets used within the macro?
For example, if I record a macro, and later, I add a row above or below a
cell used within the macro, is there a way to force the macro to understand
the change in the cell reference as a result of adding the row? Currently,
whenever I write a macro, and subsequently add rows, the macro will not
execute due to the movement of the cell references from their original
location. I am trying to find out if this can be fixed in the programming.

Thanks.

Gary''s Student

Visual Basic 6.5 in Excel
 
The usual way is to define a Named range in the worksheet and use that Name
in the VBA code. As you insert/remove rows/columns, the Name will adjust.
--
Gary''s Student - gsnu200770


"mrogge2895" wrote:

When modiifying a macro recorded in excel, is there a way to program the code
to automatically recognize changes made within sheets used within the macro?
For example, if I record a macro, and later, I add a row above or below a
cell used within the macro, is there a way to force the macro to understand
the change in the cell reference as a result of adding the row? Currently,
whenever I write a macro, and subsequently add rows, the macro will not
execute due to the movement of the cell references from their original
location. I am trying to find out if this can be fixed in the programming.

Thanks.


mrogge2895

Visual Basic 6.5 in Excel
 
I see. I will give that a try, and see if it works. Thank you.

"Gary''s Student" wrote:

The usual way is to define a Named range in the worksheet and use that Name
in the VBA code. As you insert/remove rows/columns, the Name will adjust.
--
Gary''s Student - gsnu200770


"mrogge2895" wrote:

When modiifying a macro recorded in excel, is there a way to program the code
to automatically recognize changes made within sheets used within the macro?
For example, if I record a macro, and later, I add a row above or below a
cell used within the macro, is there a way to force the macro to understand
the change in the cell reference as a result of adding the row? Currently,
whenever I write a macro, and subsequently add rows, the macro will not
execute due to the movement of the cell references from their original
location. I am trying to find out if this can be fixed in the programming.

Thanks.



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

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