ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   adding rows to spreadsheet after macro is written (https://www.excelbanter.com/excel-programming/328089-adding-rows-spreadsheet-after-macro-written.html)

iamn94

adding rows to spreadsheet after macro is written
 
I need to add some rows and / or columns to a spreadsheet. After I add the
columns / rows, the macros that I built blow up. I have tried adding $ signs
to the cell references, ie: Range("D56") becomes Range ("$D$56), but this
does not seem to work. In excel the formulas scale to reflect any row/col
additions or deletions.

Any thoughts on what I should do to the macro language to ensure that the
macro changes and the layout of the sheet changes?

Thanks
--
sd

Vasant Nanavati

adding rows to spreadsheet after macro is written
 
I find that the best solution is to name the ranges that you want to use in
your macros. Then use the range names instead of the cell references.

--

Vasant



"iamn94" wrote in message
...
I need to add some rows and / or columns to a spreadsheet. After I add

the
columns / rows, the macros that I built blow up. I have tried adding $

signs
to the cell references, ie: Range("D56") becomes Range ("$D$56), but this
does not seem to work. In excel the formulas scale to reflect any row/col
additions or deletions.

Any thoughts on what I should do to the macro language to ensure that the
macro changes and the layout of the sheet changes?

Thanks
--
sd




Don Guillett[_4_]

adding rows to spreadsheet after macro is written
 
best to use a defined range name that will auto adjust
insertnamedefinename it mysumrange
in the refers to box
=offset($a$2,0,0,counta($a:$a,1)
look n help for offset. adjust to your needs

--
Don Guillett
SalesAid Software

"iamn94" wrote in message
...
I need to add some rows and / or columns to a spreadsheet. After I add

the
columns / rows, the macros that I built blow up. I have tried adding $

signs
to the cell references, ie: Range("D56") becomes Range ("$D$56), but this
does not seem to work. In excel the formulas scale to reflect any row/col
additions or deletions.

Any thoughts on what I should do to the macro language to ensure that the
macro changes and the layout of the sheet changes?

Thanks
--
sd





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

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