Thread
:
Why does rngDataSource.Rows.Count = 65536 when worksheet Rows=95?
View Single Post
#
1
Dave Peterson
Posts: n/a
That seems like a nice approach.
But be careful. If I select A1:B10, I have two columns, but only one area.
But if I select A1:A10, then ctrl-click on B1:B10, I have two areas.
So I would think you'd have to watch out for that, too.
wrote:
Here is the solution to the last selected column problem for chart axis labeling
described below.
sColLabel1 = rngDataSource.Areas(1).Cells(1, 1)
sColLabel2 = rngDataSource.Areas(2).Cells(1, 1)
If rngDataSource.Areas(2).Column < rngDataSource.Areas(1).Column Then
sColLabel1 = rngDataSource.Areas(2).Cells(1, 1)
sColLabel2 = rngDataSource.Areas(1).Cells(1, 1)
End If
This code will make sColLabel2 equal to the rightmost column label even if the
rightmost selected column was selected first.
Dennis
wrote:
Thanks Dave!
myRng.Areas(2).Cells(1, 1) is just what I was looking for. I did not know how
to address the first cell in the 2nd selected column. I didn't know that
"Areas" existed.
What I was trying to do is simplify the code for finding the first cell, which
is a column header, in the 2nd selected column.
For the total code the user(that's me) selects any two columns from a worksheet,
clicks on an icon and a xyScatterChart is displayed of those columns with the
axis's labeled with the first cells from each of the two selected columns. I
gave the code for this macro in my previous post on 7/19/05 entitled "Problem
w/Chart Axis Labeling with VBA"
One problem remains. The xyScatterChart always chooses the right most column
selected as it's Y axis no matter whether it was selected first or last. When
the user selects the rightmost column first and then selects a column to the
left of this column the axis labels will be reversed. Is there anyway to tell
which column is furthest to the right? That is the selected column number?
Thanks.
Dennis
--
Dave Peterson
Reply With Quote