PC Review


Reply
Thread Tools Rate Thread

bi-directional dropdown boxes

 
 
TheObstacleIsThePath@gmail.com
Guest
Posts: n/a
 
      27th Feb 2007
I have a column of data that is selected using a dropdown box. The
value placed here is looked up by the adjacent column to display some
text corresponding to the first. --let me try to be more specific
for clarity -- When I select a diagnostic number in column A, the
corresponding text appears in column B.

There are times when I cannot remember the number for a particular
diagnosis, and want to instead use a dropdown list on column B which
would result in the number appearing automatically in column A.

I don't think this is possible without scripts. Can anyone get me
started on this? I'm thinking I need to put drop down boxes on both
columns and then have changes to A trigger an update to B, and B
trigger an update to A.

Can anyone get me started with an elegant solution?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?VG9tIE9naWx2eQ==?=
Guest
Posts: n/a
 
      27th Feb 2007
Right click on the worksheet tab and select view code.

In the resulting module at the top, in the left dropdown select worksheet
and in the right dropdown select change (assumes you are using xl2000 or
later).

Private Sub Worksheet_Change(ByVal Target As Range)

End Sub

target will be reference to the cell that triggered the update.

Private Sub Worksheet_Change(ByVal Target As Range)
Dim res As Variant
On Error GoTo ErrHandler
If Target.Count > 1 Then Exit Sub
If Target.Column = 1 Then
res = Application.VLookup(Target.Value, Worksheets("Data") _
.Range("A:B"), 2, False)
If Not IsError(res) Then
Application.EnableEvents = False
Target.Offset(0, 1).Value = res
End If
ElseIf Target.Column = 2 Then
res = Application.Match(Target.Value, Worksheets("Data") _
.Range("B:B"), 0)
If Not IsError(res) Then
Application.EnableEvents = False
Target.Offset(0, -1).Value = Worksheets("Data") _
.Cells(res, 1).Value
End If
End If

ErrHandler:
Application.EnableEvents = True

End Sub
--
Regards,
Tom Ogilvy


"(E-Mail Removed)" wrote:

> I have a column of data that is selected using a dropdown box. The
> value placed here is looked up by the adjacent column to display some
> text corresponding to the first. --let me try to be more specific
> for clarity -- When I select a diagnostic number in column A, the
> corresponding text appears in column B.
>
> There are times when I cannot remember the number for a particular
> diagnosis, and want to instead use a dropdown list on column B which
> would result in the number appearing automatically in column A.
>
> I don't think this is possible without scripts. Can anyone get me
> started on this? I'm thinking I need to put drop down boxes on both
> columns and then have changes to A trigger an update to B, and B
> trigger an update to A.
>
> Can anyone get me started with an elegant solution?
>
>

 
Reply With Quote
 
TheObstacleIsThePath@gmail.com
Guest
Posts: n/a
 
      1st Mar 2007
Thanks!!!!


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown boxes Arturo Microsoft Dot NET 1 15th Jan 2008 06:59 AM
Dropdown Boxes again Col Microsoft Excel Discussion 2 9th Feb 2006 10:18 PM
Dropdown boxes =?Utf-8?B?c3V6bmFs?= Microsoft Excel Misc 1 5th Oct 2004 04:35 PM
Dropdown boxes =?Utf-8?B?c3V6bmFs?= Microsoft Excel Misc 2 5th Oct 2004 04:27 PM
Dropdown boxes Paul Goodfellow Microsoft Excel Discussion 1 4th Sep 2003 08:57 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:25 AM.