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

asked 2019-09-13 13:32:01 +0200

updated 2019-09-13 17:22:56 +0200

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 flag offensive close merge delete

Comments

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.

Gilberto Schiavinatto gravatar imageGilberto Schiavinatto ( 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.

SM_Riga gravatar imageSM_Riga ( 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.

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