# How can I define a new or modify an existing named DB range using macros in Calc ?

Hello, I'm trying to create a macro that would define a new DB range from existing tables or modify an existing db range to include new data added to the tables. I couldn't figure it out so I tried recording a macro but it failed to create the named DB range.

edit retag close merge delete

To recognize new data, use a larger area than the one used, and identify the end of the table to alert, so when you add it below it recognizes.

If in the spreadsheet I only have this area, define by the whole column.

( 2019-09-13 17:19:59 +0200 )edit

Macro recorder has limited functionality and can produce unexpectable results. I suppose your DB range is not connected to some registered database to import data from table/query and you just use it as a reference to cell range? If so, Named range shall be used instead. While cell range reference of your Named range can be changed via macro (you need to change ReferencedCells property of the NamedRange object), the easier way is what @Gilberto Schiavinatto offered.

( 2019-09-15 00:42:01 +0200 )edit

the way Gilberto Schiavinatto suggested is what I have already been doing for a while now. It works fine, I know. But I was curious and tried fiddling with macros to do things that I have been doing manually or things that were hardcoded.

( 2019-09-15 01:31:26 +0200 )edit