Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default bi-directional dropdown boxes

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?

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default bi-directional dropdown boxes

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


" 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?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 17
Default bi-directional dropdown boxes

Thanks!!!!


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
Dropdown boxes (box 1 result = box 2 Greg Excel Worksheet Functions 4 August 14th 09 03:19 PM
How to copy Dropdown boxes? salut Excel Programming 1 December 22nd 05 06:58 PM
dependent dropdown boxes Kevin M Excel Worksheet Functions 0 December 8th 05 10:51 PM
Forms - Dropdown Boxes Olivia Excel Programming 0 November 18th 04 09:43 PM
AutoFilter Dropdown Boxes Missing Debra Dalgleish[_2_] Excel Programming 0 July 9th 03 04:19 AM


All times are GMT +1. The time now is 10:06 PM.

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"