Hi all,

I want to make a macro that inserts upper and/or lower limits in a graph.
For example when I insert in a textbox: 100
I want a horizontal line in my graph with y=100 (if possible a line that fits the range of my dataset)

This is what I already did:
I made a userform with 2 text boxes where i can enter an upper limit and lower limit and an ok button.
Now I want to use this to make my limits


I'm new to VBA, I think it should look like this:
ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""UpperLimit"""
ActiveChart.SeriesCollection(1).XValues = "=Tekstbox1.Value/Tekstbox1.Value" -> (error)
ActiveChart.SeriesCollection(1).Values = "=0 until 'range of my data set' " -> ( No idea if this is possible)

ActiveChart.SeriesCollection.NewSeries
ActiveChart.SeriesCollection(1).Name = "=""lowerLimit"""
ActiveChart.SeriesCollection(1).XValues = "=Tekstbox2.Value/Tekstbox2.Value" -> (error)
ActiveChart.SeriesCollection(1).Values = "=0 until 'range of my data set' " -> ( No idea if this is possible)

When a textbox is empty -> dont plot a limit

All help is welcome !