cssc1
asked on
How to delete data in cells in last entry
The macro below copies cells C7 to L7 on sheet “Main” and adds this data the first empty cell on sheet “Main Menu”. The macro below the first macro should delete the last entry but does not work?
I have tried to reverse this process (delete the last entry in cells B to K on sheet “Main Menu” but get errors.
++++++++++++++++++++++++++ ++++++++++ ++++++++++ ++++++++++ +++++
Sub AddEntryToDB()
Application.ScreenUpdating = False
Sheets("Main").Select
Range("C7:L7").Select
Selection.Copy
'
Sheets("Main Menu").Select
Range("A1").Select
If Application.WorksheetFunct ion.CountA ("A:A") = 0 Then
[A1].Select
Else
On Error Resume Next
Columns(2).SpecialCells(xl CellTypeBl anks)(1, 1).Select
If Err <> 0 Then
On Error GoTo 0
[A65536].End(xlUp)(2, 1).Select
End If
On Error GoTo 0
End If
ActiveSheet.Paste
Sheets("Main").Select
Range("A1").Select
Application.CutCopyMode = False
Range("A1").Select
End Sub
++++++++++++++++++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++++++++ ++++
Sub DeleteEntryToDB()
Application.ScreenUpdating = False
'
Sheets("Main Menu").Select
Range("A1").Select
If Application.WorksheetFunct ion.CountA ("A:A") = 0 Then
[A1].Select
Else
On Error Resume Next
Columns(2).SpecialCells(xl CellTypeBl anks)(1, 1).Select
If Err <> 0 Then
On Error GoTo 0
[A65536].End(xlUp)(2, 1).Select
End If
On Error GoTo 0
End If
ActiveSheet.Delete
Sheets("Main").Select
Range("A1").Select
Application.CutCopyMode = False
Range("A1").Select
End Sub
P-217---Good-Catch-Application---Version
I have tried to reverse this process (delete the last entry in cells B to K on sheet “Main Menu” but get errors.
++++++++++++++++++++++++++
Sub AddEntryToDB()
Application.ScreenUpdating
Sheets("Main").Select
Range("C7:L7").Select
Selection.Copy
'
Sheets("Main Menu").Select
Range("A1").Select
If Application.WorksheetFunct
[A1].Select
Else
On Error Resume Next
Columns(2).SpecialCells(xl
If Err <> 0 Then
On Error GoTo 0
[A65536].End(xlUp)(2, 1).Select
End If
On Error GoTo 0
End If
ActiveSheet.Paste
Sheets("Main").Select
Range("A1").Select
Application.CutCopyMode = False
Range("A1").Select
End Sub
++++++++++++++++++++++++++
Sub DeleteEntryToDB()
Application.ScreenUpdating
'
Sheets("Main Menu").Select
Range("A1").Select
If Application.WorksheetFunct
[A1].Select
Else
On Error Resume Next
Columns(2).SpecialCells(xl
If Err <> 0 Then
On Error GoTo 0
[A65536].End(xlUp)(2, 1).Select
End If
On Error GoTo 0
End If
ActiveSheet.Delete
Sheets("Main").Select
Range("A1").Select
Application.CutCopyMode = False
Range("A1").Select
End Sub
P-217---Good-Catch-Application---Version
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER