Have a List in a pop-up

RafaInfo

New Member
Joined
Dec 22, 2020
Messages
4
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi everyone,

How can I add a Selection-box in a pop up?

I have an InputBox, that once value entered, it adds the value to a given cell:
____________________________________________________
Sub AddValue ()

Dim Lastrow As Long
Lastrow = Cells (Rows.Count, "A").End(x1Up).Row +1
Dim firstvalue As String
firstvalue = InputBox("Enter first value","First Value")
Dim LString As String
LString = firstvalue
Cells (Lastrow, 1).Value = firstvalue
Dim secondvalue As String
secondvalue = InputBox("Enter second value","Second Value")
LString = secondvalue
Cells (Lastrow, 2).Value = secondvalue
_________________________________________________________

What I want to do, is that for the secondvalue it shows me a selection box of a list I have on a second worksheet, and if I select one element of the list, it will be shown on the given cell.


Big thanks,
Rafael
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You would most likely have to use a userform to do what you want. What is the name of the second sheet and in what range is your list on that sheet?
 
Upvote 0
Solution
Try something like this:
It uses Split
Enter your values in a InputBox like this
Alpha,Bravo,Charlie

In this example I'm entering 3 values

and more if needed
Be sure and put a comma between each value like I did
Here is a sample:
Add more if needed

VBA Code:
Sub Split_Me()
'Modified  1/7/2021  10:31:18 AM  EST
Dim ans As String
Dim Lastrow As Long
Lastrow = Cells(Rows.Count, "A").End(xlUp).Row + 1
Dim LString As String
Dim LArray() As String
ans = InputBox("Enter Value Like this:  Alpha,Bravo,Charlie")
LString = ans
LArray = Split(LString, ",")

Cells(Lastrow, 1).Value = LArray(0)
Cells(Lastrow, 2).Value = LArray(1)
Cells(Lastrow, 3).Value = LArray(2)
End Sub
 
Upvote 0

Forum statistics

Threads
1,213,567
Messages
6,114,342
Members
448,570
Latest member
rik81h

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top