Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,452
Default Mulitple Entries in InputBox

Something like this will I think do what you want:

Sub test()

Dim strInput As String
Dim arr1
Dim arr2
Dim i As Byte

arr2 = Array("value 1", "value 2", "value 3", "value 4")

strInput = InputBox("Pick up to 4 of the following numbers, separated by
comma's:" & _
vbCrLf & vbCrLf & _
"1. value 1" & vbCrLf & _
"2. value 2" & vbCrLf & _
"3. value 3" & vbCrLf & _
"4. value 4" & vbCrLf & vbCrLf & _
"The corresponding values will be placed in cells
starting at column A", _
"entering values")

If Len(strInput) = 0 Or StrPtr(strInput) = 0 Then
Exit Sub
End If

Range(Cells(1), Cells(4)).ClearContents

If InStr(1, strInput, ",", vbBinaryCompare) = 0 Then
Cells(1) = arr2(Val(Trim(strInput)) - 1)
Exit Sub
End If

arr1 = Split(strInput, ",")

For i = 0 To UBound(arr1)
Cells(i + 1) = arr2(Val(Trim(arr1(i))) - 1)
Next

End Sub


It will need a bit further working out to work with the different rows, but
that shouldn't be too difficult.


RBS


"Jim Jackson" wrote in message
...
I have a routine which inserts a new row for data input and then pops up an
inout box. Presently the input box is being used to populate one specific
cell in the new row. I have to add several new columns on the spreadsheet
and will have to use Inputbox to populate those cells as well. Is there a
way to have one Inputbox ask for three or four answers for the related
cells?
I have included the current code below.

Title = Counterparty
msg1 = "Enter the counterparty type: "" c "" = customer, "" dm "" = dealer
macro hedge (portfolio hedge), "" dh "" = dealer hedge (for the above
trade),
"" i "" = internal Your entry will be placed in a column to the
right
labeled, ""Counterparty"""
Custdlrint = InputBox(msg1, Title, Default, 15, 15)
If Custdlrint = Cancel Then
Exit Sub
Else
End If


Thanks,

Jim


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
Mulitple value lookup kritter286 Excel Worksheet Functions 5 April 20th 09 10:16 PM
Combine Multiple Entries with differing amounts of entries Katie Excel Worksheet Functions 2 November 28th 07 09:53 PM
Find duplicate entries within mulitple worksheets, then listing th Gayla Excel Worksheet Functions 1 May 17th 06 02:43 AM
Changes to Mulitple Worksheets Mac Landers Excel Worksheet Functions 3 January 26th 05 12:59 AM
Inputbox and Application.InputBox Maria[_7_] Excel Programming 1 September 20th 04 11:36 AM


All times are GMT +1. The time now is 05:24 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"