Forum Discussion

Martin Aboaf Petit de Murat's avatar
Martin Aboaf Petit de Murat
Copper Contributor
Feb 26, 2023
Solved

How to multiply two Integer variables within another and then use it to count rows?

I made a macro that serves me to subdivide an invoice that in turn can have one or more regions (rows) that divide the products by activity and establishment. You can also have a single row. What is ...
  • mtarler's avatar
    Feb 27, 2023
    I don't understand all that you are doing but highly recommend you use the 'Immediate' window (you can toggle showing it using Ctrl-G or under the View menu). For example:
    Print activecell.address
    $B$9
    Print activecell.offset(2,2).address
    $D$11
    Print activecell.offset(2,2).range("A1").address
    $D$11
    Print activecell.offset(2,2).range("B2").address
    $E$12
    so basically my point here is that the .range("A1") is not extending or moving your range but rather acting like offset but since it is "A1" it is like offset of 0,0
    hope that is helpful

Resources