+ Reply to Thread
Results 1 to 4 of 4

Cannot Clear Out Used Range

  1. #1
    Registered User
    Join Date
    12-13-2013
    Location
    Kansas City
    MS-Off Ver
    Excel 2010
    Posts
    15

    Cannot Clear Out Used Range

    The excel document attached to this thread has a macro designed to create a text string by taking data from the input tab, generating the text string on the TDIN Formula tab, and then copying the result on the TDIN Formula tab on the TDIN tab for each fund. The resulting text string on the TDIN tab is then used to import input data into tax software.

    The macro in question is linked to the box at the top of the input tab ("Step 3: Create CCH Import File"). Before you run it, look at the tab titled TDIN, and notice that from row 288 to row 8867, all of the cells are blank, and after this break the text string picks back up and goes to row 11727. If you run the macro, it was designed to delete out all values in the TDIN tab and then paste the updated text string, but it keeps adding a big gap between the first fund and the rest of the funds, and the gap grows every time you run the macro. Every time, it will post the first fund in the place it is supposed to, but then it adds the second fund on after the original usedrange. I have the line "ActiveSheet.UsedRange" in the vba code, which up til 2 weeks ago, worked to clear the used range. Any idea how I can correct this?


    Please Login or Register  to view this content.
    Last edited by bwink88; 02-25-2014 at 12:44 PM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Cannot Clear Out Used Range

    ActiveSheet.UsedRange does not clear anything, but ActiveSheet.UsedRange.clearcontents can do it
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    12-13-2013
    Location
    Kansas City
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Cannot Clear Out Used Range

    I just tried adding .clearcontents to the end of that line and it didn't fix the problem. It is still doing the same thing.

  4. #4
    Registered User
    Join Date
    12-13-2013
    Location
    Kansas City
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Cannot Clear Out Used Range

    I was able to work around the problem I'm having by changing a couple of lines of code and switching out line in the If/Next loop
    Please Login or Register  to view this content.
    (which was taking me to the last cell in the former used range) with
    Please Login or Register  to view this content.
    .

    While I have found a work around, I would really like to know if anyone has an explanation that might explain why I can no longer clear out my used range. I would really appreciate it.

    Here is the full code for the macro after the changes I made...

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-13-2013
    Location
    Kansas City
    MS-Off Ver
    Excel 2010
    Posts
    15

    Re: Cannot Clear Out Used Range

    Hi Patel45, my appologies, I didn't include the macro with your suggestion added to it.

    After including this, I ran the macro, I tried saving it and exiting out of the template to see if it would go away when I exited, but when I opened it back up, it was still recognizing the old used range. Do you know if there is a setting in excel that could interfere with this? Thank you very much for your help.

    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. Clear range based on cell value - clearing cells out of specified range
    By CADiphile in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-15-2013, 02:48 PM
  2. Replies: 1
    Last Post: 06-21-2013, 04:05 AM
  3. [SOLVED] VBA Clear Cells for one range if cell in other range is blank
    By DoodlesMama in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2013, 06:23 PM
  4. Range.clear failure
    By Jollyfrog in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 10-05-2010, 07:28 AM
  5. Clear date range
    By anita.r in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-02-2008, 06:09 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