Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Using Arrays in InputBox Method

Hello Board

I would like the default value of the Input box to be the array: 10,20,40
and of course the user may specify an array of his own.

But I cannot get the Array values to be accepted by this method and I cannot
figure out why:

Dim vAggregations As Variant
vAggregations = Application.InputBox(Prompt:="Enter LB horizons (in
rollovers):", Title:="Lookbacks", Default:=Array("10,20,40"), Type:=64)


If the user wishes to accept the default values, pressing OK on the Dialog
box does nothing. The box remains there apparently still waiting for input.
What am I doing wrong?

Thank you

W


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using Arrays in InputBox Method

Sub tester10()
Dim vAggregations As Variant
vAggregations = Application.InputBox( _
Prompt:="Enter LB horizons (in rollovers):", _
Title:="Lookbacks", Default:="{10,20,40}", _
Type:=64)
Debug.Print vAggregations(1), vAggregations(2), _
vAggregations(3)
End Sub


works for me. The user would need to enter it that way as well {20,50,90}
as an example.

Regards,
Tom Ogilvy


verizon wrote in message
...
Hello Board

I would like the default value of the Input box to be the array: 10,20,40
and of course the user may specify an array of his own.

But I cannot get the Array values to be accepted by this method and I

cannot
figure out why:

Dim vAggregations As Variant
vAggregations = Application.InputBox(Prompt:="Enter LB horizons (in
rollovers):", Title:="Lookbacks", Default:=Array("10,20,40"), Type:=64)


If the user wishes to accept the default values, pressing OK on the Dialog
box does nothing. The box remains there apparently still waiting for

input.
What am I doing wrong?

Thank you

W




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Using Arrays in InputBox Method

Thank you Tom

So it appears that my mistake was that I did not include the brackets {} in
my Default definition?


"Tom Ogilvy" wrote in message
...
Sub tester10()
Dim vAggregations As Variant
vAggregations = Application.InputBox( _
Prompt:="Enter LB horizons (in rollovers):", _
Title:="Lookbacks", Default:="{10,20,40}", _
Type:=64)
Debug.Print vAggregations(1), vAggregations(2), _
vAggregations(3)
End Sub


works for me. The user would need to enter it that way as well

{20,50,90}
as an example.

Regards,
Tom Ogilvy


verizon wrote in message
...
Hello Board

I would like the default value of the Input box to be the array:

10,20,40
and of course the user may specify an array of his own.

But I cannot get the Array values to be accepted by this method and I

cannot
figure out why:

Dim vAggregations As Variant
vAggregations = Application.InputBox(Prompt:="Enter LB horizons (in
rollovers):", Title:="Lookbacks", Default:=Array("10,20,40"), Type:=64)


If the user wishes to accept the default values, pressing OK on the

Dialog
box does nothing. The box remains there apparently still waiting for

input.
What am I doing wrong?

Thank you

W






  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Using Arrays in InputBox Method

you tried to use a VBA array, but the application.Inputbox works much like a
virtual cell - so apparently it speaks Excel array notation.

Regards,
Tom Ogilvy


verizon wrote in message
...
Thank you Tom

So it appears that my mistake was that I did not include the brackets {}

in
my Default definition?


"Tom Ogilvy" wrote in message
...
Sub tester10()
Dim vAggregations As Variant
vAggregations = Application.InputBox( _
Prompt:="Enter LB horizons (in rollovers):", _
Title:="Lookbacks", Default:="{10,20,40}", _
Type:=64)
Debug.Print vAggregations(1), vAggregations(2), _
vAggregations(3)
End Sub


works for me. The user would need to enter it that way as well

{20,50,90}
as an example.

Regards,
Tom Ogilvy


verizon wrote in message
...
Hello Board

I would like the default value of the Input box to be the array:

10,20,40
and of course the user may specify an array of his own.

But I cannot get the Array values to be accepted by this method and I

cannot
figure out why:

Dim vAggregations As Variant
vAggregations = Application.InputBox(Prompt:="Enter LB horizons

(in
rollovers):", Title:="Lookbacks", Default:=Array("10,20,40"),

Type:=64)


If the user wishes to accept the default values, pressing OK on the

Dialog
box does nothing. The box remains there apparently still waiting for

input.
What am I doing wrong?

Thank you

W








  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default Using Arrays in InputBox Method

That's it. I erred on the syntax of the Array() setup. Thank you very
much.

W


"Tom Ogilvy" wrote in message
...
Actually, this does work - I didn't notice your array was

Array("10,20,40").
That would be a one element array. Using a three element array
Array(10,20,40) as follows:

Sub tester10()
Dim vAggregations As Variant
vAggregations = Application.InputBox( _
Prompt:="Enter LB horizons (in rollovers):", _
Title:="Lookbacks", Default:=Array(10, 20, 40), _
Type:=64)
Debug.Print vAggregations(1), vAggregations(2), _
vAggregations(3)
End Sub


But it puts up each element one at at time - so you get three input boxes,
each querying for one element.

Regards,
Tom Ogilvy



verizon wrote in message
...
Even though i used Array("10,20,30").....

For my own sanity, do you have an idea why the above does not work?

W

"Tom Ogilvy" wrote in message
...
Sub tester10()
Dim vAggregations As Variant
vAggregations = Application.InputBox( _
Prompt:="Enter LB horizons (in rollovers):", _
Title:="Lookbacks", Default:="{10,20,40}", _
Type:=64)
Debug.Print vAggregations(1), vAggregations(2), _
vAggregations(3)
End Sub


works for me. The user would need to enter it that way as well

{20,50,90}
as an example.

Regards,
Tom Ogilvy


verizon wrote in message
...
Hello Board

I would like the default value of the Input box to be the array:

10,20,40
and of course the user may specify an array of his own.

But I cannot get the Array values to be accepted by this method and

I
cannot
figure out why:

Dim vAggregations As Variant
vAggregations = Application.InputBox(Prompt:="Enter LB horizons

(in
rollovers):", Title:="Lookbacks", Default:=Array("10,20,40"),

Type:=64)


If the user wishes to accept the default values, pressing OK on the

Dialog
box does nothing. The box remains there apparently still waiting

for
input.
What am I doing wrong?

Thank you

W










Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Please post this thread a correct full method, method about Nast Runsome New Users to Excel 8 February 25th 08 03:29 PM
Detecting Cancel in an InputBox Method Connie Excel Discussion (Misc queries) 2 October 19th 06 01:32 PM
Inputbox method using type:=8 - How to Cancel? Joe 90 Excel Programming 0 July 10th 03 12:24 AM
Inputbox method using type:=8 - How to Cancel? Harlan Grove[_5_] Excel Programming 1 July 9th 03 12:06 AM
Inputbox method using type:=8 - How to Cancel? Jim Cone Excel Programming 0 July 8th 03 06:15 PM


All times are GMT +1. The time now is 02:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"