I want to clarify..is End(Excel.XlDirection) the right function to find last used cell in that specific column?
Have been cracking my brain and looking thru threads in my weekend but still isnt getting anywhere.
here's the code I tried:
CODE
Dim rng As Excel.Range
Dim colNum As Integer
colNum = 2
rng = WSheet.Cells(WSheet.Rows.Count, colNum)._
End(Excel.XlDirection.xlDown)
With xlsAxisCategory.Item(Excel.XlAxisType.xlCategory)
.HasTitle = True
.AxisTitle.Characters.Text = "Time"
.HasMajorGridlines = True
.HasMinorGridlines = True
.MinimumScale = 0.479166666666667
.MaximumScale = rng.Value '0.486111111111111
.MinorUnit = 0.000347222222222222
.MajorUnit = 0.000694444444444444
.Crosses = XlAxisCrosses.xlAxisCrossesAutomatic
.ReversePlotOrder = False
.ScaleType = XlScaleType.xlScaleLinear
.TickLabels.Orientation = XlTickLabelOrientation._
xlTickLabelOrientationUpward
End With
The whole graph's x-axis went hay wire.
I place the rng.value at ".MaximumScale = rng.Value '0.486111111111111"
And '0.486111111111111 is actually the value I enter initially which the graph work perfectly.
'0.486111111111111 refer to the last cell i select in the 2nd column "B" (time column), which is actually 11:40:00 and the excel convert it to 0.486111111111111.
But I want the program to select last cell itself instead of me selecting it.
I'm not sure if I am using the correct function.
I also tried this code:
CODE
rangEndTime = WSheet.UsedRange._
End(Excel.XlDirection.xlDown).Row
With xlsAxisCategory.Item(Excel.XlAxisType.xlCategory)
.MaximumScale = rangEndTime.ToString '0.486111111111111
End with
The graph still haywire as well.
I really need help. I notice that the topic has been read but no one reply.
Million thanks!