Forum Discussion
Martin Aboaf Petit de Murat
Feb 26, 2023Copper Contributor
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 ...
- Feb 27, 2023I 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
mtarler
Feb 27, 2023Silver Contributor
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
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
- Martin Aboaf Petit de MuratFeb 27, 2023Copper Contributor
mtarler thanks!!!