Cell value change on drop-down list item change

Status
Not open for further replies.

vamshivemula

New Member
Joined
Apr 20, 2009
Messages
6
Hi,

I need a cell value (assuming B1) to be changed as soon as you select an item from other Excel drop-down list cell (assuming A1) and move AWAY from that cell (like "Lostfocus" event in VB). Both A1 and A2 are in Sheet1 of Workbook. This should happen without button press, worksheet change/activate, etc. For example, I have one column that is being pulled to the drop-down list from different sheet (assuming Sheet2) and its related info in the column parallel to it in Sheet2. I want this function to be called when the drop-down list loses focus. I currently did it in different way, i.e., I have written VBA code on "Worksheet_SelectionChange" when it reaches to the next cell (taking ActiveCell.Address - assuming cell A2 gets selected/activated), but a user has to go to that particular cell (A2) to run this VBA function, otherwise it never triggers. I want this function to be triggered when A1 (drop-down list cell) get deselected or loses focus. Your help is greatly appreciated.

Regards,

Vamshi
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
Thanks Rory...

Your tip worked and as per your tip, I modified your example code per my requirements and the code goes like this:

Range(“I9”) is drop-down in Sheet1<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:eek:ffice:eek:ffice" /><o:p></o:p>
For name cell >>>>> “=PullName(I9)”<o:p></o:p>
For E-mail cell >>>>> “=PullEmail(I9)”<o:p></o:p>
<o:p></o:p>
Function PullName(myName) As String<o:p></o:p>
myRow = 4<o:p></o:p>
myCol = 3<o:p></o:p>
<o:p></o:p>
Do Until Sheet7.Cells(myRow, myCol).Value = ""<o:p></o:p>
If Sheet7.Cells(myRow, myCol) = myName Then<o:p></o:p>
myName = Sheet7.Cells(myRow, myCol - 1)<o:p></o:p>
Exit Do<o:p></o:p>
Else<o:p></o:p>
myRow = myRow + 1<o:p></o:p>
End If<o:p></o:p>
Loop<o:p></o:p>
PullName = myName<o:p></o:p>
End Function<o:p></o:p>
<o:p></o:p>
Function PullEmail(myEmail) As String<o:p></o:p>
myRow = 4<o:p></o:p>
myCol = 3<o:p></o:p>
<o:p></o:p>
Do Until Sheet7.Cells(myRow, myCol).Value = ""<o:p></o:p>
If Sheet7.Cells(myRow, myCol) = myEmail Then<o:p></o:p>
myEmail = Sheet7.Cells(myRow, myCol + 1)<o:p></o:p>
Exit Do<o:p></o:p>
Else<o:p></o:p>
myRow = myRow + 1<o:p></o:p>
End If<o:p></o:p>
Loop<o:p></o:p>
PullEmail = myEmail<o:p></o:p>
End Function


Thanks a lot again Rory... Your Rock!! :)
<!-- / message -->
 
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,214,983
Messages
6,122,595
Members
449,089
Latest member
Motoracer88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top