Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Mulitple value lookup | Excel Worksheet Functions | |||
Combine Multiple Entries with differing amounts of entries | Excel Worksheet Functions | |||
Find duplicate entries within mulitple worksheets, then listing th | Excel Worksheet Functions | |||
Changes to Mulitple Worksheets | Excel Worksheet Functions | |||
Inputbox and Application.InputBox | Excel Programming |