#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default input box

Is it possible to have an input box with two or more entry boxes in it or am
I just limited to creating user forms for that?

Thanks,
Kevin
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default input box

The input box only allows one entry, although it can be of variable length.
The InputBox method offers a way to limit the input to specific data types,
whereas the InputBox function returns only strings. I don't understand the
two boxes question.

"Kevin" wrote:

Is it possible to have an input box with two or more entry boxes in it or am
I just limited to creating user forms for that?

Thanks,
Kevin

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 504
Default input box

Like if I wanted an Input box to ask for name and date or something.


"JLGWhiz" wrote:

The input box only allows one entry, although it can be of variable length.
The InputBox method offers a way to limit the input to specific data types,
whereas the InputBox function returns only strings. I don't understand the
two boxes question.

"Kevin" wrote:

Is it possible to have an input box with two or more entry boxes in it or am
I just limited to creating user forms for that?

Thanks,
Kevin

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default input box

If you want two data elements that would be entered on a sheet somewhere in
separate cells, then probably the UserForm with a couple of TextBox controls
would be the easiest to work with. Dave's suggestion of using an array for
the InputBox method would need some programming savvy to work with, but is
feasible also. My personal preference would be the UserForm with TextBoxes.

"Kevin" wrote:

Like if I wanted an Input box to ask for name and date or something.


"JLGWhiz" wrote:

The input box only allows one entry, although it can be of variable length.
The InputBox method offers a way to limit the input to specific data types,
whereas the InputBox function returns only strings. I don't understand the
two boxes question.

"Kevin" wrote:

Is it possible to have an input box with two or more entry boxes in it or am
I just limited to creating user forms for that?

Thanks,
Kevin

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default input box

As a user, I would much rather see a userform with separate areas for each
response--or even a couple of inputboxes...

But if you wanted, you could use application.inputbox() and ask for an array to
be returned:

Option Explicit
Sub testme()
Dim myArr As Variant
Dim iCtr As Long
Dim userCancelled As Boolean

Dim resp As Long

myArr = Application.InputBox(prompt:="Three values", Type:=64 + 2, _
Default:=Array("first", "second", "third"))

userCancelled = False
For iCtr = LBound(myArr) To UBound(myArr)
If myArr(iCtr) = False Then
userCancelled = True
End If
MsgBox myArr(iCtr)
Next iCtr

If userCancelled Then
Exit Sub
End If

'more code here

End Sub

You could also use:

Sub testme2()
Dim myArr As Variant
Dim iCtr As Long
Dim userCancelled As Boolean

Dim resp As Long

myArr = Application.InputBox(prompt:="Multiple values", Type:=64)

userCancelled = False
For iCtr = LBound(myArr) To UBound(myArr)
If myArr(iCtr) = False Then
userCancelled = True
End If
MsgBox myArr(iCtr)
Next iCtr

If userCancelled Then
Exit Sub
End If

'more code here

End Sub
and have the user type the response as:

{"asdf",1,"qwer",17}

Replace the comma with the user's windows list separator

Kevin wrote:

Is it possible to have an input box with two or more entry boxes in it or am
I just limited to creating user forms for that?

Thanks,
Kevin


--

Dave Peterson


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
input in number form is being multiplied by 1000 when i input. jweinograd Excel Discussion (Misc queries) 4 April 16th 07 11:18 PM
Have user input converted to uppercase in same cell as input? Shannonn New Users to Excel 1 June 20th 06 03:19 AM
How do I add input data in the input ranges in drop down boxes. oil_driller Excel Discussion (Misc queries) 1 November 9th 05 10:31 PM
=SUMIF(Input!H2:H718,AZ19,Input!E2:E685)AND(IF ALex Excel Worksheet Functions 2 March 14th 05 09:19 PM
CODE to select range based on User Input or Value of Input Field Sandi Gauthier Excel Programming 4 December 8th 03 03:22 PM


All times are GMT +1. The time now is 12:19 PM.

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

About Us

"It's about Microsoft Excel"