I have a table (Table2) that contains properties informations, in the first column (Código do Imóvel) i have a code for the property. I have a cell ("Alterar Registro de Imóveis", F3) with data validation based in the values of the first column from the table. I want to delete the row started with the given code, when the user click two yes through msgboxes.
I tried ListRows and Match to find the number from the row.
Someone know how to do this?
VBA Code:
If MsgBox("Tem certeza que deseja deletar " & Sheets("Alterar Registro de Imóveis").Range("F3") & "?", vbExclamation + vbYesNo, "Deletar Imóvel") = vbYes Then
If MsgBox("Após essa confirmação, o registro " & Sheets("Alterar Registro de Imóveis").Range("F3") & " será deletado permanentemente. Deseja continuar?", vbExclamation + vbYesNo, "Deletar Imóvel") = vbYes Then
Worksheets("Tabela de Imóveis").ListObjects("Table2").ListRows(Application.Match(Sheets("Alterar Registro de Imóveis").Range("F3"), Worksheets("Tabela de Imóveis").ListObjects("Table2").ListRows("Código do Imóvel"), 0), 2).Delete
End If
End If
Someone know how to do this?