Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How to delete data in cells in last entry

Posted on 2014-07-23
2
Medium Priority
?
156 Views
Last Modified: 2014-07-23
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.WorksheetFunction.CountA("A:A") = 0 Then
 [A1].Select
 Else
 On Error Resume Next
 Columns(2).SpecialCells(xlCellTypeBlanks)(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.WorksheetFunction.CountA("A:A") = 0 Then
 [A1].Select
 Else
 On Error Resume Next
 Columns(2).SpecialCells(xlCellTypeBlanks)(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
0
Comment
Question by:cssc1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 34

Accepted Solution

by:
Norie earned 2000 total points
ID: 40215238
This will delete the last entries on Main Menu.
Sub DeleteEntryToDB()
    Application.ScreenUpdating = False
    Sheets("Main Menu").Range("B" & Rows.Count).End(xlUp).Resize(,10).ClearContents
    Application.ScreenUpdating = True
End Sub

Open in new window

0
 

Author Closing Comment

by:cssc1
ID: 40215328
THanks this works GREAT!!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

722 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question