J
Joel Mills
I started with this code. It allows the user to input 4 lines of text into
a ChartTitle. I'm trying to modify it to allow the user to enter a single
line of text or up to 4 lines of text . I want it to exit the first time
the user doesn't input anything in the Inputboxes. Or be able to cancel the
inputbox without removing the text already in the chart title. I've tried
using a label and "If then GoTo" but not sure if this approach is right or
how to get it to work. I can post the revised code if it might be helpful.
Joel Mills
Sub ChartTitle()
Dim CTitle1 As String
Dim CTitle2 As String
Dim CTitle3 As String
Dim CTitle4 As String
ChartTitle1 = InputBox("Enter 1st Line of Chart Title")
ChartTitle2 = InputBox("Enter 2nd Line of Chart Title")
ChartTitle3 = InputBox("Enter 3rd Line of Chart Title")
ChartTitle4 = InputBox("Enter 4th Line of Chart Title")
ActiveSheet.ChartObjects("Curve Chart").Activate
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = ChartTitle1 & Chr(10) _
& ChartTitle2 & Chr(10) & ChartTitle3 & Chr(10) _
& ChartTitle4 & Chr(10)
End With
End Sub
a ChartTitle. I'm trying to modify it to allow the user to enter a single
line of text or up to 4 lines of text . I want it to exit the first time
the user doesn't input anything in the Inputboxes. Or be able to cancel the
inputbox without removing the text already in the chart title. I've tried
using a label and "If then GoTo" but not sure if this approach is right or
how to get it to work. I can post the revised code if it might be helpful.
Joel Mills
Sub ChartTitle()
Dim CTitle1 As String
Dim CTitle2 As String
Dim CTitle3 As String
Dim CTitle4 As String
ChartTitle1 = InputBox("Enter 1st Line of Chart Title")
ChartTitle2 = InputBox("Enter 2nd Line of Chart Title")
ChartTitle3 = InputBox("Enter 3rd Line of Chart Title")
ChartTitle4 = InputBox("Enter 4th Line of Chart Title")
ActiveSheet.ChartObjects("Curve Chart").Activate
With ActiveChart
.HasTitle = True
.ChartTitle.Characters.Text = ChartTitle1 & Chr(10) _
& ChartTitle2 & Chr(10) & ChartTitle3 & Chr(10) _
& ChartTitle4 & Chr(10)
End With
End Sub