M
Mouimet
I need to name a group of cells in vba. I need to add a few lines just to
name cells in my macro and refer to that range. The problem is the range (row
and Col) is variable. The macro I wrote do not work and keep the same range.
Here my needs:
1- Table always start at cell A4
2- Row and columns are variable and can be anything
3- I need to add this vba line inside a macro.
Here the line I did to name cells.
If I create a new file with more rows the macro keep the same range R20C11 and
name the cells. Macro do not go to the last cells. Why?
Thanks
==========
Range("A4").Select
Selection.SpecialCells(xlCellTypeLastCell).Select
ActiveWorkbook.Names.Add Name:="HvacTable", RefersToR1C1:= _
"=Sheet1!R4C1:R20C11"
name cells in my macro and refer to that range. The problem is the range (row
and Col) is variable. The macro I wrote do not work and keep the same range.
Here my needs:
1- Table always start at cell A4
2- Row and columns are variable and can be anything
3- I need to add this vba line inside a macro.
Here the line I did to name cells.
If I create a new file with more rows the macro keep the same range R20C11 and
name the cells. Macro do not go to the last cells. Why?
Thanks
==========
Range("A4").Select
Selection.SpecialCells(xlCellTypeLastCell).Select
ActiveWorkbook.Names.Add Name:="HvacTable", RefersToR1C1:= _
"=Sheet1!R4C1:R20C11"