简体   繁体   中英

How do i delete the last row from a separate excel sheet VBA

I have a button that is on sheet2 and i am trying to delete the last row in sheet1 using VBA.

When i delete the row, i dont want my screen to go to sheet1.

This was happening when i tried to use.activate.

Private Sub CommandButton3_Click()

ActiveSheet.Cells(Rows.Count, "A").End(xlUp).EntireRow.Delete


End Sub

If the name of the first sheet is Sheet1 then use:

Sheets("Sheet1").Cells(Rows.Count, "A").End(xlUp).EntireRow.Delete

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM