+ Reply to Thread
Results 1 to 6 of 6

Delete fixed Rows and Columns

  1. #1
    Registered User
    Join Date
    04-06-2014
    Location
    SA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Delete fixed Rows and Columns

    I have a daily variance report I export to Excel and every day I have to delete certain rows and the certain columns before I can run a macros to delete all the zero value rows. I can not run this macros before the time as the the rows and columns that I delete contain zero values and thus I will lose most of my work if I run the Macros before hand.

    The rows and columns are set, so the exact same rows and columns are deleted every day. So I need a macros to delete the set rows and then another macros to delete the columns. I'm not very good with programming so any help will help.


    Thanks in advance...

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,048

    Re: Delete fixed Rows and Columns

    Ok so luckily this should be a very easy thing but let me start with a few questions.


    What rows need to be deleted?
    What columns need to be deleted?
    If you already have a macro to run AFTER you delete said columns and rows, why not include the code in the beginning of THAT code so you can just run one macro?
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Registered User
    Join Date
    04-06-2014
    Location
    SA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Delete fixed Rows and Columns

    I can give you the list off rows to be removed but it's a couple if pages (30) worth. I thought I would save you the hard word and add it if I knew where or how to include it in the code. The rows will be specific lines number and rows so it has no barring on the content of the cells.

    If we can add it to once macros it will be great. Just please keep in mind that I'm not the smartest peanut in the packet when it comes to programming.

    Sub HideRowsByZero()
    'Update 20131107
    Dim Rng As Range
    Dim WorkRng As Range
    On Error Resume Next
    xTitleId = "KutoolsforExcel"
    Set WorkRng = Application.Selection
    Set WorkRng = Application.InputBox("Range", xTitleId, WorkRng.Address, Type:=8)
    For Each Rng In WorkRng
    If Rng.Value = "0" Then
    Rng.EntireRow.Hidden = True
    End If
    Next
    End Sub

  4. #4
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,048

    Re: Delete fixed Rows and Columns

    Range("A:D, H:K").delete 'This deletes columns A through D and H through K

    Sorry my phone was going nuts on me and wouldn't let me edit this post so I gave up on it.
    Last edited by mikeTRON; 04-07-2014 at 02:20 PM.

  5. #5
    Registered User
    Join Date
    04-06-2014
    Location
    SA
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Delete fixed Rows and Columns

    Thank you very much for the info. Where do I insert this code in the existing macros I provided above...

  6. #6
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,048

    Re: Delete fixed Rows and Columns

    So to delete rows or columns you have a few ways to do it.

    You can use the Range, Rows or Columns as shown below.

    Columns ("A:C").delete

    Rows("5:6").delete

    Range("A:A").delete or
    Range("1:1").delete


    So lets assume you want to delete row 5 and 10 and columns E and J use the following code:

    Please Login or Register  to view this content.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Copying a formula with fixed rows but different columns
    By Mikethebike19 in forum Excel General
    Replies: 3
    Last Post: 11-27-2013, 06:34 AM
  2. how to create a range with fixed columns and changing rows
    By shettyp in forum Excel - New Users/Basics
    Replies: 4
    Last Post: 01-19-2012, 02:52 AM
  3. Lookup from fixed rows and dynamic columns
    By Alexvs in forum Excel General
    Replies: 2
    Last Post: 11-09-2010, 05:39 AM
  4. Dynamic Range of Columns with fixed Rows
    By nms2130 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 01-05-2009, 05:24 PM
  5. [SOLVED] Excel 2000 - Fixed size columns and rows?
    By stainless in forum Excel General
    Replies: 2
    Last Post: 07-29-2005, 06:05 PM

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