Aldic 0 Newbie Poster

Dear All,

I'm working on application in C# which needs to filter "blanks" in one column and copy some value from other column instead. Filtering works perfectly, but copying is not so cool.. It copies some lines, but rest left blank. I cant find out where is problem. If possible please check my function below and if you have some idea, please let me know. Thank you Very much, Alan

private void fill_blank_pn()
        {
            //set filter
            Excel.Range rg_Set_Filter = (Excel.Range)xlWorkSheet.Rows[1];
            rg_Set_Filter.Activate();
            rg_Set_Filter.Select();
            rg_Set_Filter.AutoFilter(17, "=", Excel.XlAutoFilterOperator.xlAnd, Type.Missing, true);

            Excel.Range visibleCells = xlWorkSheet.UsedRange.SpecialCells(Excel.XlCellType.xlCellTypeVisible, Type.Missing);

            for (int area_Id = 1; area_Id <= visibleCells.Areas.Count; area_Id++)
            {
                string ACT_PN = "Q" + visibleCells.Areas.get_Item(area_Id).Row.ToString();


                Excel.Range act_Col_PN = xlWorkSheet.get_Range(ACT_PN, ACT_PN);


                act_Col_PN.FormulaR1C1 = "=RC[4]";
            }

            //cancel filter
            Excel.Range rg_Cancel_F = (Excel.Range)xlWorkSheet.Rows[1];
            rg_Cancel_F.Activate();
            rg_Cancel_F.Select();
            rg_Cancel_F.AutoFilter(17, Type.Missing, Excel.XlAutoFilterOperator.xlAnd, Type.Missing, true);
        }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.