user112233
New Member
- Joined
- Mar 25, 2014
- Messages
- 1
I need to create 50 histograms, so I recorded a macro that creates 1 histogram. The code is this:
I want to modify this macro, so that it creates not only this one histogram, but 50 histograms with ranges
and so on. I think I should use a for loop, but I don't know how to loop through letters. $BH$1 is the first element of the 2 column output range, so I need it to be shifted by 2 in every step.
What I did was copy/pasted this code 50 times and rewrote the ranges manually, but I think it can be done with loops as well.
Thank you!
Code:
<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit;">[COLOR=#00008B]Sub[/COLOR] histcreate
Application.Run [COLOR=#800000]"ATPVBAEN.XLAM!Histogram"[/COLOR], ActiveSheet.Range( _ [COLOR=#800000]"$A$3:$A$1601"[/COLOR]), ActiveSheet.Range([COLOR=#800000]"$BH$1"[/COLOR]), , [COLOR=#800000]False[/COLOR], [COLOR=#800000]False[/COLOR], [COLOR=#800000]True[/COLOR], _ [COLOR=#800000]True
[/COLOR][COLOR=#00008B]End[/COLOR] [COLOR=#00008B]Sub[/COLOR]</code>
Code:
<code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; white-space: inherit;">[COLOR=#800000]"$B$3:$B$1601"[/COLOR] [COLOR=#800000]"$C$3:$C$1601"[/COLOR]</code>
and so on. I think I should use a for loop, but I don't know how to loop through letters. $BH$1 is the first element of the 2 column output range, so I need it to be shifted by 2 in every step.
What I did was copy/pasted this code 50 times and rewrote the ranges manually, but I think it can be done with loops as well.
Thank you!