ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Updating VB Code (https://www.excelbanter.com/excel-programming/328121-updating-vbulletin-code.html)

Adam

Updating VB Code
 
Is there any way to automatically update the VB code when you add/delete
rows/columns in the worksheets or do I need to change all the Range("Cell")
inputs that are affected by this change?

Tom Ogilvy

Updating VB Code
 
If "Cell" is a defined name, then you shouldn't have to make any changes in
the code.

--
Regards,
Tom Ogilvy

"Adam" wrote in message
...
Is there any way to automatically update the VB code when you add/delete
rows/columns in the worksheets or do I need to change all the

Range("Cell")
inputs that are affected by this change?




Bob Phillips[_6_]

Updating VB Code
 
You need to ensure that your code caters for however many rows there may be,
be it by using named ranges, maybe dynamic named ranges, or determining at
run time how many rows/columns there are.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Adam" wrote in message
...
Is there any way to automatically update the VB code when you add/delete
rows/columns in the worksheets or do I need to change all the

Range("Cell")
inputs that are affected by this change?




Adam

Updating VB Code
 
In this case the code is created by a recorded macro, hence the code is e.g.
Range("C12") etc. I realize that this is what creates the problem since it
does not update to Range("C13") when I add one row in the worksheet. Is there
a way around this.?

"Tom Ogilvy" skrev:

If "Cell" is a defined name, then you shouldn't have to make any changes in
the code.

--
Regards,
Tom Ogilvy

"Adam" wrote in message
...
Is there any way to automatically update the VB code when you add/delete
rows/columns in the worksheets or do I need to change all the

Range("Cell")
inputs that are affected by this change?





Tom Ogilvy

Updating VB Code
 
select C12. In the name box type CellC (as an example). (or use
Insert=Name=Define, Name: CellC, RefersTo: =Sheet1!$C$12)

In the recorded code, replace
Range("C12")
with

Range("CellC")

--
Regards,
Tom Ogilvy

"Adam" wrote in message
...
In this case the code is created by a recorded macro, hence the code is

e.g.
Range("C12") etc. I realize that this is what creates the problem since it
does not update to Range("C13") when I add one row in the worksheet. Is

there
a way around this.?

"Tom Ogilvy" skrev:

If "Cell" is a defined name, then you shouldn't have to make any changes

in
the code.

--
Regards,
Tom Ogilvy

"Adam" wrote in message
...
Is there any way to automatically update the VB code when you

add/delete
rows/columns in the worksheets or do I need to change all the

Range("Cell")
inputs that are affected by this change?








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

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