C
CLamar
I have a Listbox in Excel and I am trying to loop through and delete the
duplicate entries. How can I do this using VBA
Thanks
duplicate entries. How can I do this using VBA
Thanks
Once again thanks for the quick response, but now its giving me a runtime
error 457 "this key is already associated with an element of this collection"
How would you locate the last cell in a column using the R1C1 method?
Okay I understand that, but how am i supposed to find the last cell in a
column so that i can use it in a series to create a plot without hardcoding
it.
thanks
This should probably be posted under a different question just in case
someone needs to use it, but anyway the problem i am having is that i am
trying to do a scatterplot, but i dont want to hardcode the the range because
it is going to change. Below is what i get for that section when i record
the macro, but i need to modify it to work for any size range, that is why i
asked how do you find the lastrow
With ActiveChart
.SeriesCollection.XValues = "=Sheets("DataTable").Range("a2:A" &
LastRoww).Cells
.SeriesCollection.Values = "=DataTable!R2C6:R21C6"
.SeriesCollection.Values = "=DataTable!R2C7:R21C7"
.HasTitle = True
.ChartType = xlXYScatterLines
.HasLegend = False
.ApplyDataLabels Type:=xlDataLabelsShowValue
.Axes(xlCategory, xlPrimary).HasTitle = True
.Axes(xlCategory, xlPrimary).AxisTitle.Characters.Text = "Dist"
.Axes(xlValue, xlPrimary).HasTitle = True
.Axes(xlValue, xlPrimary).AxisTitle.Characters.Text = "VRH1"
End With
"
It is now giving me the error "Method of rows object _Global failed" and it
is not in the help section of VBA
First let me say, I do appreciate your assistance with this.
Here is my code below, I made some minor changes which is probably the cause
of the error. Here is the entire Sub:
Sub VRHCharts()
Dim LastCellx As Long
Dim LastCelly As Long
On Error Resume Next
Application.DisplayAlerts = False
Charts("VRH1").Delete
On Error GoTo 0
Application.ScreenUpdating = False
Charts.Add
ActiveChart.Name = "VRH1"
LastCellx = Sheets("DataTable").Cells(Rows.Count, "F").End(xlUp).Row
LastCelly = Sheets("DataTable").Cells(Rows.Count, "G").End(xlUp).Row
With ActiveChart
.SeriesCollection.NewSeries
.SeriesCollection(1).XValues = Range("f2:F" & LastCellx)
.SeriesCollection(1).Values = Range("g2:G" & LastCelly)
.HasTitle = True
.ChartType = xlXYScatterSmooth
.HasLegend = False
.ApplyDataLabels Type:=xlDataLabelsShowValue
.Axes(xlCategory).TickLabels.Orientation = xlHorizontal
.ChartTitle.Font.Bold = True
.ChartTitle.Font.Size = 12
.PlotArea.Top = 18
.PlotArea.Height = 162
.Axes(xlValue).MaximumScale = 0.6
.Deselect
End With
Application.ScreenUpdating = True
End Sub
Hopefully this will be the last question on this topic. The code below works
fine when the range is G2 - G12, but when it changes to something longer for
example G2-G47 it gives me the error: " Unable to set the values property to
the series class". And the error doesnt apply to the XValues only the
.Values statement. I put an "**" where the error is occuring. I am assuming
it is having a problem with the SeriesCollection
Thanks