Posts by jmart

    royUK


    That code works, but it isn't deleting just the row below the filter headers as I have 5 total rows of data to start, then I end with 4. Then i perform the macro again and down to 3 and so on. Eventually just left with the last entry that I modified.


    Row 4 has the headers and I am filtering based on column A. When filtered, I need to have only the row filtered deleted, none others.


    Any suggestions?

    I have a complex userform where I am using it to overwrite and save data in a filtered data set. I am using a filter in part of my user form upon a button click to filter data based on text box value in the user form. After changing information in the user form, I would like to select the data being filtered (first row of data beneath filter) and delete it so that I can copy and paste the data in the form to the dataset and have unique values and not duplicate.


    The Filter Row headers are on Row 4. The row I want to select will be right below the header (always only 1 selection), but could be any row value based upon when it was entered into sheet. Essentially I need to be able to select the first filtered row beneath the header and delete that row.


    The code below I have found, but it is deleting more rows than the one being filtered.


    Code
    1. Private Sub YesCancel1_Click()
    2. Dim LR As Long
    3. LR = Range("A" & Rows.Count).End(xlUp).Row
    4. Sheets("Database").Range("A4:AN" & LR).SpecialCells(xlCellTypeVisible).Select
    5. Selection.Delete
    6. End Sub



    This is the last bit of code to complete my tool. Your help is appreciated!