I have a Word doc with a userform. The userform has a ComboBox
(cmbPortfolio) and a text box (txtPortfolioDetails). I simply want
cmbPortfolio to get its list from column A in Excel. When a person makes a
choice, it inputs the result of the corresponding column B into
txtPortfolioDetails. I have a dynamic range named "rngPortfolio" assigned to
columns A and B in the spreadsheet. This sounds like it would be simple,
yet I can't seem to get started.
Thanks in advance!!!
Your combo box's list should display only the first column, but it can also
invisibly store the second column. Then the combo box's _Change() procedure
just needs to set the text box's .Text property equal to the combo box's
.Text property.
--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
That brings up another point: If you use a combo box instead of a list box,
there is the possibility that the user typed in a value instead of choosing
one from the list, and in that case there wouldn't be any "corresponding
value from the second column". To prevent this, you need to set the combo
box's .MatchRequired property to True.
Jay Freedman wrote:
> Take a look at the article
> http://gregmaxey.mvps.org/Populate_UserForm_ListBox.htm, especially
> the code samples labeled "Excel Example" 1 through 3 that show how to
> get the data from Excel into the .List member of the combo box.
> Although Greg uses a list box, the same technique works with a combo
> box (which is really just the combination of a list box and an edit
> box).
> Your combo box's list should display only the first column, but it
> can also invisibly store the second column. Then the combo box's
> _Change() procedure just needs to set the text box's .Text property
> equal to the combo box's .Text property.
>
>
Todd
"Jay Freedman" <jay.fr...@verizon.net> wrote in message
news:OBe0UVS%23KH...@TK2MSFTNGP06.phx.gbl...
"Jay Freedman" <jay.fr...@verizon.net> wrote in message
news:OBe0UVS%23KH...@TK2MSFTNGP06.phx.gbl...
--
Hope this helps.
Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.
Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
"Todd" <To...@christianfp.com> wrote in message
news:8E35A262-4227-43A6...@microsoft.com...
Todd
"Doug Robbins - Word MVP" <d...@REMOVECAPSmvps.org> wrote in message
news:DD57E76D-B7B0-4FB1...@microsoft.com...