Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Drop down-list translation

I run Excel 2003 on Windows Vista.
I want to drive an HTML page with the following excerpt:
<select id="title" name="title" tabindex='0' onfocus='rememberMyFocus("
title");'
<option value=""-- Please select --</option
<option value="0001"Ms</option
<option value="0002"Mr</option
<option value="Z030"Mrs</option
<option value="Z040"Miss</option
....
</select

I have a drop down list, populated from the first column in:
Titles Code
Ms 0001
Mr 0002
Mrs Z030
Miss Z040
....

In VBA code, I can easily translate titles to codes with something like
Private Function TranslateTitle(ByVal Title As String) As String
Select Case Title
Case "Ms"
TranslateTitle = "0001"
Case "Mr"
TranslateTitle = "0002"
Case "Mrs"
TranslateTitle = "Z030"
Case "Miss"
TranslateTitle = "Z040"
...
End Select
End Function

I prefer to do the translation in Excel, itself and have a cell formula
=VLOOKUP(B5, Sheet3!A2:B69, 2, False)

That does not use the offset in the named range I use for validation.
Is there a "better" way to do the translation?
--
Walter Briscoe
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 464
Default Drop down-list translation

See this page for different ways.
http://www.ozgrid.com/Excel/cell-lookup.htm



--
Regards
Dave Hawley
www.ozgrid.com
"Walter Briscoe" wrote in message
...
I run Excel 2003 on Windows Vista.
I want to drive an HTML page with the following excerpt:
<select id="title" name="title" tabindex='0' onfocus='rememberMyFocus("
title");'
<option value=""-- Please select --</option
<option value="0001"Ms</option
<option value="0002"Mr</option
<option value="Z030"Mrs</option
<option value="Z040"Miss</option
...
</select

I have a drop down list, populated from the first column in:
Titles Code
Ms 0001
Mr 0002
Mrs Z030
Miss Z040
...

In VBA code, I can easily translate titles to codes with something like
Private Function TranslateTitle(ByVal Title As String) As String
Select Case Title
Case "Ms"
TranslateTitle = "0001"
Case "Mr"
TranslateTitle = "0002"
Case "Mrs"
TranslateTitle = "Z030"
Case "Miss"
TranslateTitle = "Z040"
...
End Select
End Function

I prefer to do the translation in Excel, itself and have a cell formula
=VLOOKUP(B5, Sheet3!A2:B69, 2, False)

That does not use the offset in the named range I use for validation.
Is there a "better" way to do the translation?
--
Walter Briscoe


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 279
Default Drop down-list translation

Thank you. That is sweet. I have 2 lists with about 20 and about 50
translations. I use the choose method for the shorter and the index
method for the latter, so I have examples of both.

In message of Tue, 4 May 2010
15:12:21 in microsoft.public.excel.programming, ozgrid.com
writes
See this page for different ways.
http://www.ozgrid.com/Excel/cell-lookup.htm

--
Walter Briscoe
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
drop down list based on other drop down list pick Ruth Excel Discussion (Misc queries) 1 August 25th 09 04:12 PM
Drop down list dependant on previous drop down list Tenacioushail Excel Discussion (Misc queries) 1 July 1st 08 11:35 AM
Drop down lists that auto create and then filter the next drop down list [email protected] Excel Worksheet Functions 2 September 30th 07 11:53 AM
Drop Down List choice selecting another drop down list CVD0722 Excel Worksheet Functions 3 October 31st 06 01:02 PM
multiple select from the drop down list in excel. list in one sheet and drop down in sriramus Excel Discussion (Misc queries) 5 October 27th 05 06:55 PM


All times are GMT +1. The time now is 12:23 AM.

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

About Us

"It's about Microsoft Excel"