DSUM() changing Database range automatically when used in macro
I want to use the DSUM() function on a named range. I am using a macro to insert this range in cells on a button click-Insert.
The problem is that the DSUM(database, field, critera) - database is starting from column L3:M25, but when I start using the macro, the range of database is increasing every time like from L3:M50 and so on. After multiple inserts the database range 开发者_开发技巧is starting from L5 instead of L3. How do I fix this??
Please post your insert macro.
As a general hint from the distance, I'd say that ...
... if you insert entire rows in the middle of your database range, this range will automatically expand. if you insert only cells (with xlShiftDown or xlShiftRight parameters) your database range may be destroyed.
... keep one blank line between the criteria range and the database range and don't insert into the criterium range
... try out all possible inserts by hand before you let the macro do it and display the database range boundaries by clicking its name in the drop-down field above the column header lines
精彩评论