XValues and values.

Y

y

How may I set up, via VBA, Xvalues and Values obtained by user via a user form?

I'm goind mad about this thing! It's two days I'm on.

Thanks to all that answered me last two days but I thougth easier doing this thing. It's getting too
hard for me.

Whatever is the problem? Range convert to array or viceversa? Why is so diffucult to accomplsh this
target?

Thanks in advance.

Alex.
 
W

Wei-Dong XU [MSFT]

Hi Alex,

XValues and Values property can accept the Array or Range type. I am not quite familiar with your user form design. For receiving the Array, you
will need to convert the string value from the user input. For example:
'-----------------------------------
Dim sArray as String
Dim oArray()
sArray = InputBox( "Input the Value array with comma splited" )
oArray = Array(sArray)
'Then you can specify the oArray to the Values or XValues property directly.
'...
'-----------------------------------

From my view, for the data from the User Form, I'd suggest you can retrieve the string of the ranges for XValues and Values. Your user can only
need to specify the Range string to the input box, then using the codes below will set the Range to XValues and Values respectively. If the
inputed range string is not valid. Inputbox will reports error to the user.

Dim oXValues as Range
set oXValues = InputBox(prompt:="range for XValues", type:=8)
Charts("Chart1").SeriesCollection(1).XValues = oXValues

Dim oValues as Range
set oValues = InputBox(prompt:="range for Values", type:=8)
Charts("Chart1").SeriesCollection(1).Values = oValues

Please feel free to let me know if you have any further questions.

Best Regards,
Wei-Dong Xu
Microsoft Product Support Services
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top