ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   linked cell (https://www.excelbanter.com/excel-programming/338817-linked-cell.html)

Chris

linked cell
 
Hi.

Ive got a small question
Is there a possibility to link the VBA code to the cells? So when you are
referring to cell A1 and you insert a row the VBA script automatically
changes the value to A2.

Best regards,

Chris


Rocky McKinley

linked cell
 
Click on the cell A1 then Insert(menu) Name Define ... name it "mycell"
Try inserting rows and columns the code below should refer to the same cell
because named ranges keep there relative reference when cells, columns or
rows are deleted or inserted.

Range("mycell") = Range("mycell") + 1

--
Regards,
Rocky McKinley


"chris" wrote in message
...
Hi.

I've got a small question
Is there a possibility to link the VBA code to the cells? So when you are
referring to cell A1 and you insert a row the VBA script automatically
changes the value to A2.

Best regards,

Chris




Mangesh Yadav[_4_]

linked cell
 
use named ranges.
So when you insert a row, the named range also shifts and your VBA code is
not affected.

Mangesh



"chris" wrote in message
...
Hi.

I've got a small question
Is there a possibility to link the VBA code to the cells? So when you are
referring to cell A1 and you insert a row the VBA script automatically
changes the value to A2.

Best regards,

Chris





All times are GMT +1. The time now is 06:30 PM.

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