Consulting

Results 1 to 4 of 4

Thread: Solved: Delete specific rows from all spreadsheets

  1. #1
    VBAX Regular
    Joined
    Jan 2007
    Posts
    28
    Location

    Solved: Delete specific rows from all spreadsheets

    I need to delete the first 3 rows of every worksheet in the current workbook. Could someone give me the code to do this in a module?

  2. #2
    MS Excel MVP VBAX Tutor
    Joined
    Mar 2005
    Posts
    246
    Location
    [VBA]
    Sub DeleteFirstThreeRows()
    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets
    ws.Range("1:3").Delete
    Next
    End Sub
    [/VBA]
    - Jon
    -------
    Jon Peltier, Microsoft Excel MVP
    Peltier Technical Services
    Tutorials and Custom Solutions
    http://PeltierTech.com
    _______

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Ssinghal
    Welcome to VBAX
    I've retitled your question title to make it more meaningful for searches. If your question is solved, you can mark it so using the Thread Tools dropdown.
    Regards
    MD
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    VBAX Master XLGibbs's Avatar
    Joined
    Jan 2006
    Location
    state of confusion, but vacation in denial
    Posts
    1,315
    Location
    You can also do this manually for all sheets needed by:

    Holding down CTRL and selecting all the sheets by clicking them (or by clicking the left most and then finding the right most and clicking to select all sheets, or by right clicking any sheet tab and choosing Select All Sheets.

    Once selected, you can rows 1 to 3 in any column on the sheet you are on, right click>delete entire row and <poof> they are gone.
    If you have posted the same question at multiple forums, please read this IMPORTANT INFO.

    Please use the thread tools to mark your thread Solved


    Please review the Knowledge Base
    for samples and solutions , or to submit your own!




Posting Permissions

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