Microsoft Excel

Herbers Excel/VBA-Archiv

Informationen und Beispiele zum Thema CommandButton
BildScreenshot zu CommandButton CommandButton-Seite mit Beispielarbeitsmappe aufrufen

Deleting rows

Betrifft: Deleting rows von: Marc
Geschrieben am: 04.11.2014 07:24:34

Hello,

please see attached file. I would like to chose with the combo box a value in column A. Once I chose it the corresponding row ( where the value is located ) should be deleted.

Thanks for help!

Marc

https://www.herber.de/bbs/user/93528.xlsx

  

Betrifft: AW: Deleting rows von: MCO
Geschrieben am: 04.11.2014 07:31:52

Good morning!

add this code to the button:

Private Sub CommandButton1_Click()

Set found_cell = Range("A:A").Find(Range("B1"))
Rows(found_cell.Row).Delete

End Sub
Please be sure, that the row to be deleted does not contain the data of the Combobox (row 1)

Greetings, MCO


  

Betrifft: AW: Deleting rows von: Marc
Geschrieben am: 05.11.2014 16:40:25

Hello,

this is great. Thank you.

Marc