Can a chart title contain an integer variable or array index

askinsb

New Member
Joined
Aug 4, 2003
Messages
11
I am querying the worksheet and getting back the values I want and storing the values in an array.

Dim mynumbers(4) as Integer

I then want to update a chart title when the new numbers something like this.

Selection.Characters.Text = _
"Weekly Numbers" & Chr(10) & " mynumbers(1) " & Chr(10) &

How the chart title doesn't like any variable that are Integers and/or indexes in arrays that are Integers.

Any ideas? Can you convert Integers to string?

Brad
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Re: Can a chart title contain an integer variable or array i

Maybe:

Selection.Characters.Text = _
"Weekly Numbers" & Chr(10) & CStr(mynumbers(1)) & Chr(10)

but I think the quotes surrounding mynumbers(1) is your main problem.
 
Upvote 0

askinsb

New Member
Joined
Aug 4, 2003
Messages
11
Re: Can a chart title contain an integer variable or array i

Hey Andrew,

Thanks you were right on both accounts.

Here is the code that wound up working for me.

Selection.Characters.Text = _
"Confirmed By Severity" & Chr(10) & "P1 = " & CStr(mynumbers(1)) & Chr(10) & "P2 = " & CStr(mynumbers(2)) & Chr(10) & _
"P3 = " & CStr(mynumbers(3)) & Chr(10) & "P4 = " & CStr(mynumbers(4))

Thanks again.

Brad
 
Upvote 0

Forum statistics

Threads
1,186,908
Messages
5,960,524
Members
438,481
Latest member
KBChristensen

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top