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.
Private Sub YesCancel1_Click()
Dim LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
Sheets("Database").Range("A4:AN" & LR).SpecialCells(xlCellTypeVisible).Select
Selection.Delete
End Sub
This is the last bit of code to complete my tool. Your help is appreciated!