Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have this code for deleting the last row inserted from a form. I need to
edit this so as to ignore the first row. How could I do this? Private Sub CommandButton6_Click() Dim LastRowOnSheet As Long LastRowOnSheet = Sheets("Sheet1").UsedRange.Rows.Count + Sheets("Sheet1").UsedRange.row - 1 Sheets("Sheet1").Cells(LastRowOnSheet, 1).EntireRow.Delete End Sub |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Enyaw,
Try: '============= Private Sub CommandButton6_Click() Dim LastRowOnSheet As Long With ActiveWorkbook.Sheets("Sheet1") LastRowOnSheet = .UsedRange.Rows.Count _ + .UsedRange.Row - 1 If LastRowOnSheet 1 Then _ Rows(LastRowOnSheet).Delete End With End Sub '<<============= --- Regards, Norman "enyaw" wrote in message ... I have this code for deleting the last row inserted from a form. I need to edit this so as to ignore the first row. How could I do this? Private Sub CommandButton6_Click() Dim LastRowOnSheet As Long LastRowOnSheet = Sheets("Sheet1").UsedRange.Rows.Count + Sheets("Sheet1").UsedRange.row - 1 Sheets("Sheet1").Cells(LastRowOnSheet, 1).EntireRow.Delete End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Hpw do I delete multiple empty rows found between filled rows? | Excel Worksheet Functions | |||
Cut filtered rows, paste into next empty row of new sheet, and delete cut rows | Excel Worksheet Functions | |||
Delete rows with numeric values, leave rows with text | Excel Programming | |||
How to delete rows when List toolbar's "delete" isnt highlighted? | Excel Worksheet Functions | |||
Delete every 3rd row, then delete rows 2-7, move info f/every 2nd row up one to the end and delete the row below | Excel Programming |