Share via

Delete Specific Cell Value Rows

Anonymous
2022-08-12T12:50:05+00:00

I have multiple rows and columns of data in the excel sheet, in the "G" column there is multiple city names (Mumbai, Jaipur, Pune, Surat, Kolkata, Chennai, Ahmedabad, Hyderabad, Bangalore, Delhi). I want only Delhi, Mumbai, Kolkata and Banglore cell rows data rest want to delete. how can I do this using macro?

Microsoft 365 and Office | Excel | Other | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2022-08-12T20:42:53+00:00

    Hi Narayandatta,

    Thank you for posting your query. My name is Clarence, I'll be more than happy to assist you with your concern.

    To resolve your query kindly do the steps below.

    The following VBA code is to delete rows with specific data from the excel worksheet. This code will delete the rows (1 to 20) if cell value is “Your Data”.

    Sub sbDelete_Rows_With_Specific_Data () Dim lRow As Long Dim iCntr As Long lRow = 20 For iCntr = lRow To 1 Step -1 If Cells(iCntr, 1) = “Your Data” Then ‘ You can change this text ‘If Cells(iCntr, 1) = “22-12-2013” Then ‘ to check specific date Rows(iCntr). Delete End If Next End Sub

    Go to this link for your reference and other troubleshooting procedures https://analysistabs.com/vba/delete-rows-with-specific-value-excel-macro-example-code/

    Note: This is a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.'

    Do not hesitate to message us if you need further assistance.

    Give back to the Community. Help the next person who has this issue by indicating if this reply solved your problem. Click Yes or No below.

    Best Regards, Clarence

    Was this answer helpful?

    0 comments No comments
  2. Anonymous
    2022-08-12T18:19:12+00:00

    Hi,

    I am trying to put multiple filters but I am not able to do that.

    ActiveCell.AutoFilter Field:=10, Criteria1:="<>Mumbai", Criteria2:="<>Delhi", Criteria3:="<>Banglore", Criteria4:="<>Kolkata"

    ActiveSheet.AutoFilter.Range.Offset(1, 0).Rows.SpecialCells(xlCellTypeVisible).delete

    apart from this want to delete it. how can I do this

    Was this answer helpful?

    0 comments No comments
  3. Anonymous
    2022-08-12T13:27:13+00:00

    Hello Narayandatta,

    Thank you for coming to the forum

    I am going to give you two links, the first link has a Macros used to achieve this and the second shows you how to achieve this via the GUI.

    https://www.excelcampus.com/vba/delete-rows-cell-values/

    https://trumpexcel.com/delete-rows-based-on-cell-value/

    Note: This is a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.

    Was this answer helpful?

    0 comments No comments