+ Reply to Thread
Results 1 to 6 of 6

Reduce the file size via MACRO

  1. #1
    Forum Contributor
    Join Date
    08-15-2006
    Location
    USA
    MS-Off Ver
    Office 365, 64 bit
    Posts
    371

    Reduce the file size via MACRO

    At our dept, we use a file where we track project status and financials. Our usual routine is to dump relevant data daily into a tab from another report than we run a macro that deletes more non-relevant data rows. As we do this daily, the file size increases and I ask the users to follow the steps outlined below. What I would prefer since they are causing many errors as they attempt to do this is to have a macro that would do this automatically for them starting from row 6,001. I tried using create macro function and followed the steps below but it causes errors and it stops working... any ideas?


    STEPS
    • Find the last cell that contains data in the sheet.
    • Delete all the rows after this cell.
    • In this example, to delete the rows, select the blank cell after the last cell D11 to the data.
    • Select the cell D12.
    • Press the key Shift+Space on your keyboard.
    • Press Ctrl+****+Down Arrow key.
    • Rows will get selected till the last row.
    • Press Ctrl+- on the keyboard to delete the blank rows.

  2. #2
    Forum Contributor
    Join Date
    05-27-2014
    Location
    Belfast, Northern Ireland
    MS-Off Ver
    2007 & 2010
    Posts
    273

    Re: Reduce the file size via MACRO

    This would be a very simple VBA project. Do you want to upload a sample of the data so we can knock one out for you.
    Please click *Add Reputation if I've helped

  3. #3
    Forum Expert mikerickson's Avatar
    Join Date
    03-30-2007
    Location
    Davis CA
    MS-Off Ver
    Excel 2011
    Posts
    6,229

    Re: Reduce the file size via MACRO

    Something like

    Please Login or Register  to view this content.
    _
    ...How to Cross-post politely...
    ..Wrap code by selecting the code and clicking the # or read this. Thank you.

  4. #4
    Forum Contributor
    Join Date
    05-27-2014
    Location
    Belfast, Northern Ireland
    MS-Off Ver
    2007 & 2010
    Posts
    273

    Re: Reduce the file size via MACRO

    This will automatically find the last line and remove lines below it:
    Please Login or Register  to view this content.
    And this will remove lines below the current activecell, useful if you want the user to manually select where to delete from. Obvs, this method could be used to delete data if the user isn't careful where they click first.
    Please Login or Register  to view this content.
    Then just get a button to launch the macro and put it somewhere handy for users to use.
    Last edited by kadeo; 06-24-2016 at 11:05 AM.

  5. #5
    Forum Contributor
    Join Date
    08-15-2006
    Location
    USA
    MS-Off Ver
    Office 365, 64 bit
    Posts
    371

    Re: Reduce the file size via MACRO

    I used the 1st option (automatic vs. user) and it gets stuck at: If .Cells(.Rows.Count, i).End(xlUp).Row > LastRow Then

    The tab is not protected and I did updated the ColNum and LastRow

    Any ideas why?

  6. #6
    Forum Contributor
    Join Date
    05-27-2014
    Location
    Belfast, Northern Ireland
    MS-Off Ver
    2007 & 2010
    Posts
    273

    Re: Reduce the file size via MACRO

    Quote Originally Posted by rz6657 View Post
    I used the 1st option (automatic vs. user) and it gets stuck at: If .Cells(.Rows.Count, i).End(xlUp).Row > LastRow Then

    The tab is not protected and I did updated the ColNum and LastRow

    Any ideas why?
    Apologies, only seeing this today. When you say "gets stuck at", what's the error?

+ 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. Replies: 9
    Last Post: 05-18-2023, 07:18 PM
  2. Reduce file size
    By Bluetube in forum Excel General
    Replies: 2
    Last Post: 04-08-2016, 01:13 PM
  3. Reduce File Size
    By hasanpmp in forum Excel General
    Replies: 3
    Last Post: 05-15-2014, 05:31 AM
  4. Replies: 1
    Last Post: 12-17-2013, 03:18 PM
  5. Help me reduce 30 mb file size
    By ZenButcher in forum Excel General
    Replies: 6
    Last Post: 11-06-2009, 03:34 AM
  6. Reduce File Size
    By djfatboyfats in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 12-18-2008, 09:41 AM
  7. [SOLVED] Re: Need to Reduce the file size
    By Terry Davies in forum Excel General
    Replies: 0
    Last Post: 04-04-2006, 09:20 AM

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