Click here to Skip to main content
15,884,425 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All!

I have been trying to fix this issue since long but not sure what is really wrong. I need to populate a cell, say D3, with values based on the value selected in dropdown list in cell D1. I have 3 values in the dropdown- A, B, Overall. I used change event handlers, yet I do not see the values being populated. Please help. Below is the code snippet:
C#
            xl.EnableEvents = true;
            EventDel_CellsChange = new Excel.DocEvents_ChangeEventHandler(CellsChange1);
            ws.Change += EventDel_CellsChange;

public static void CellsChange1(Excel.Range target)
    {
    if (target.Value.ToString() == "A")
        {
            xl.EnableEvents = false;
            //Do Something
            xl.EnableEvents = true;
    }
    else if (target.Value.ToString()== "B")
        {
            xl.EnableEvents = false;
            //DoSomething
            xl.EnableEvents = true;
    }
    else
        {
            xl.EnableEvents = false;
            //Do something
            xl.EnableEvents = true;
    }


This is the first time I am working on excel using c#. Please help.
Posted
Updated 25-Oct-15 20:47pm
v2
Comments
Patrice T 26-Oct-15 2:56am    
How do you do it in Excel ? why would it be different here ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900