Dear all,
I have a large set of data. I want the user to be able to click the first and last row of data which they wish to plot. I am getting errors on the range of the selected data. Any suggestions welcomed.
Thanks,
Matt
VBA Code below:
Sub plot_selected_date()
Dim rng2 As Range
Set rng2 = Application.InputBox(prompt:="Select the date from which you wish to plot", Type:=8)
Dim rng3 As Range
Set rng3 = Application.InputBox(prompt:="Select the date up until you wish to plot", Type:=8)
add2 = rng2.Address
add3 = rng3.Address
MsgBox add2
Dim tleft As Range
Set tleft = rng2.Offset(0, 2)
Dim bright As Range
Set bright = rng3.Offset(0, 7)
'Dim box As Range
'Set box = Range(tleft:bright)
MsgBox tleft.Address
MsgBox bright.Address
' Range("add2:add3,tleft:bright").Select
'Range("C1").Activate
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("tleft:bright")
ActiveChart.ChartType = xlLine
End Sub
I have a large set of data. I want the user to be able to click the first and last row of data which they wish to plot. I am getting errors on the range of the selected data. Any suggestions welcomed.
Thanks,
Matt
VBA Code below:
Sub plot_selected_date()
Dim rng2 As Range
Set rng2 = Application.InputBox(prompt:="Select the date from which you wish to plot", Type:=8)
Dim rng3 As Range
Set rng3 = Application.InputBox(prompt:="Select the date up until you wish to plot", Type:=8)
add2 = rng2.Address
add3 = rng3.Address
MsgBox add2
Dim tleft As Range
Set tleft = rng2.Offset(0, 2)
Dim bright As Range
Set bright = rng3.Offset(0, 7)
'Dim box As Range
'Set box = Range(tleft:bright)
MsgBox tleft.Address
MsgBox bright.Address
' Range("add2:add3,tleft:bright").Select
'Range("C1").Activate
ActiveSheet.Shapes.AddChart.Select
ActiveChart.SetSourceData Source:=Range("tleft:bright")
ActiveChart.ChartType = xlLine
End Sub