A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » Worksheet Functions
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Can a cell have a drop down list and can also be auto populated



 
 
Thread Tools Display Modes
  #1  
Old March 17th, 2005, 04:17 AM
Adrian
external usenet poster
 
Posts: n/a
Default Can a cell have a drop down list and can also be auto populated

I would like to have a cell that can be autopopulated based on the content of
a different cell but also have a drop down menu that can effect the 2nd cell.

For example.
Cell #1 is a part number that if known can be entered in and autopopulate
cell #2
Cell #2 is a description of the part number, if you don't know the part
number you can use the drop down list to search and have Cell #1 autopopulate
with the info from Cell #2.

Is this possible?
  #2  
Old March 17th, 2005, 05:05 AM
Jason Morin
external usenet poster
 
Posts: n/a
Default

Assume your part numbers' range is defined as "partno"
and your part descriptions' range is defined
as "partdesc".

Set up your Validation lists in A1 and B1. Select A1, go
to Data Validation, Allow: List, Source: =partno.
Repeat for cell B1 with Source: =partdesc.

Now right-click on the worksheet tab, select "View Code",
and copy in the code below. Press ALT+Q and save the wb.

Private Sub Worksheet_Change(ByVal Target As Excel.Range)
Dim PartNoRow As Long
Dim PartDescRow As Long
With Application
If Intersect(Target, [A1]) Is Nothing Then GoTo FillA1
.EnableEvents = False
With Target
PartNoRow = Application.Match(.Value, _
Range("partno"), 0)
.Offset(0, 1).Value = Range("partdesc") _
(PartNoRow).Value
End With
.EnableEvents = True
Exit Sub
FillA1:
If Intersect(Target, [B1]) Is Nothing Then Exit Sub
.EnableEvents = False
With Target
PartDescRow = Application.Match(.Value, _
Range("partdesc"), 0)
.Offset(0, -1).Value = Range("partno") _
(PartDescRow).Value
End With
.EnableEvents = True
End With
End Sub

---
HTH
Jason
Atlanta, GA

-----Original Message-----
I would like to have a cell that can be autopopulated

based on the content of
a different cell but also have a drop down menu that can

effect the 2nd cell.

For example.
Cell #1 is a part number that if known can be entered in

and autopopulate
cell #2
Cell #2 is a description of the part number, if you

don't know the part
number you can use the drop down list to search and have

Cell #1 autopopulate
with the info from Cell #2.

Is this possible?
.

 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


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