+ Reply to Thread
Results 1 to 5 of 5

Cell Select - Delete Entire Row

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Cell Select - Delete Entire Row

    Hi, the simple following code allows me to delete items in a protected sheet. However what I want it to do is delete the entire row, as shifting the cells up causes problems with formulas moving. I am unable to select the row as I have protected against users being able to select locked cells. Is there anyway to adapt the code to "selection, delete entire row.?

    Thanks
    Chris

    Sub Macro7()
    '
    ' Macro7 Macro
    '
    
    '
        ActiveSheet.Unprotect "password"
        
        Selection.Delete Shift:=xlUp
        ActiveSheet.Protect "password", DrawingObjects:=True, Contents:=True, Scenarios:=True _
            , AllowInsertingRows:=True, AllowDeletingRows:=True
    End Sub
    Last edited by zimbo109; 03-04-2010 at 10:37 AM.

  2. #2
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,445

    Re: Cell Select - Delete Entire Row

    Does this help?

    Sub a()
    ActiveSheet.Unprotect "password"
    Selection.EntireRow.Delete
    End Sub
    Rule 1: Never merge cells
    Rule 2: See rule 1

    "Tomorrow I'm going to be famous. All I need is a tennis racket and a hat".

  3. #3
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Cell Select - Delete Entire Row

    Yes it does- thank you, however is there a way in which I can delete the entire row of selection and include the next 10 rows?
    Regards
    Chris

  4. #4
    Forum Expert sweep's Avatar
    Join Date
    04-03-2007
    Location
    Great Sankey, Warrington, UK
    MS-Off Ver
    2003 / 2007 / 2010 / 2016 / 365
    Posts
    3,445

    Re: Cell Select - Delete Entire Row

    Yes,

    To delete the selected rows, plus the next 10 rows:

    Selection.Resize(Selection.Rows.Count + 10, Selection.Columns.Count).EntireRow.Delete

  5. #5
    Forum Contributor
    Join Date
    02-05-2010
    Location
    Exeter, England
    MS-Off Ver
    Excel 2007 & 2010
    Posts
    180

    Re: Cell Select - Delete Entire Row

    Thank you Sweep.

    Regards
    Chris

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1