ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pulling Array from InputBox (https://www.excelbanter.com/excel-programming/296382-pulling-array-inputbox.html)

cogent

Pulling Array from InputBox
 
Hello

I would like a default "array" in my input box:

vLBDays = Application.InputBox(Prompt:="Enter LB horizons (in rollovers):",
Title:="Lookback Horizons", Default:="{05,10,20}", Type:=64)

but I cannot get it to work without the brackets. If the user wants
anything other than the default values, he must include brackets which is
annoying and time consuming.

Any ideas?

W



AA2e72E[_2_]

Pulling Array from InputBox
 
vLBDays = Split( Application.InputBox(Prompt:="Enter LB horizons (in rollovers):",Title:="Lookback Horizons", Default:="05,10,20", Type:=64),","

This does not check for Cancel being clicked or OK being clicked with no content in the input box-I am sure you can modify the code to cope with this

Split(string,"delimiter") converts string into an array splitting the string at "delimiter" locations): this array is zero based irrespective of Option Base setting.


All times are GMT +1. The time now is 09:44 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com