none
Delete Rows in Excel RRS feed

All replies

  • Is the file .xls or .xlsx?

    How many rows are in the file?


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, August 3, 2018 8:51 AM
  • Hi Peter,

    According to your description, your issue is more related about Excel development, And the Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools. I will move this thread to corresponding forum: Excel for Developers Forum for dedicated information.

    Thank you for your understanding.

    Regards,

    Stanly


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 6, 2018 2:13 AM
  • Hello Peter Nge,

    What application are you developing? Where should we start? 

    Will below code be  helpful?

                //My solution is to filter the worksheet with column B the condition ="LC" and then delete all the result rows
                
                //filter on the used range of the worksheet
                //2 is the field index that means column b here, "LC" is the condition
                worksheet.UsedRange.AutoFilter(2, "LC");
                // worksheet.UsedRange.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeVisible) is the result showing cells
                // delete their entire rows
                worksheet.UsedRange.SpecialCells(Microsoft.Office.Interop.Excel.XlCellType.xlCellTypeVisible).EntireRow.Delete();

    Best Regards,

    Terry


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, August 6, 2018 7:22 AM