Hello,
I am trying to learn relative referencing for excel macros, and I am having embarassing problems. I tried setting up a very simple sheet like so:
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]1
[/TD]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD]5[/TD]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD]5[/TD]
[TD][/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD][/TD]
[TD]3[/TD]
[TD][/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The first column starts in cell A1, and so forth. I click on relative reference, then record macro, and then do the following:
With the active cell in A1, do a Contrl Shift down arrow to select the range, click on the Data tab, click on Remove Duplicates, and end up with the correct result, which in this case was 3 remaining values. And I click Stop Recording. I set the same column up again and reran the macro. Correct again. When I try to run the macro for any other range, it doesn't work. It merely highlights the range. Is the fact I started the macro in cell A1 part of the problem, or should I have clicked on A1 to start recording? Thanks to anyone who could offer me some help.
Andy
I am trying to learn relative referencing for excel macros, and I am having embarassing problems. I tried setting up a very simple sheet like so:
[TABLE="class: outer_border, width: 500"]
<tbody>[TR]
[TD]1
[/TD]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD]5[/TD]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD][/TD]
[TD]1[/TD]
[TD][/TD]
[TD]5[/TD]
[TD][/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3
[/TD]
[TD][/TD]
[TD]3[/TD]
[TD][/TD]
[TD]2[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]3[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
The first column starts in cell A1, and so forth. I click on relative reference, then record macro, and then do the following:
With the active cell in A1, do a Contrl Shift down arrow to select the range, click on the Data tab, click on Remove Duplicates, and end up with the correct result, which in this case was 3 remaining values. And I click Stop Recording. I set the same column up again and reran the macro. Correct again. When I try to run the macro for any other range, it doesn't work. It merely highlights the range. Is the fact I started the macro in cell A1 part of the problem, or should I have clicked on A1 to start recording? Thanks to anyone who could offer me some help.
Andy