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.
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.
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.
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.