Results 1 to 5 of 5

Cannot Clear Out Used Range

Threaded View

  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?


    Sub CreateTextString()
    
    'Don't show Macro Process/Speed up macro
    Applicationscreenupdating = False
    
    'Clean TDIN sheet
    Sheets("TDIN").Visible = True
    Sheets("TDIN").Select
        ActiveSheet.Unprotect
        Range("A7").Select
        ActiveCell.FormulaR1C1 = "1"
        Selection.EntireRow.Delete
        Range("A2").Select
        Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
        Selection.Delete
        
    Range("A2").Select
    
    'Below Code Clears the Former Used Range
    
    ActiveSheet.UsedRange
    
    
    'Loop returns and paste formulas from TDIN Formulas to TDIN Sheet
    
    Sheets("Input").Select
    ActiveSheet.Unprotect
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "1"
    
    Sheets("Input").Select
    For Each x In Range("CopyCount")
    If Trim(x) <> "" Then
    Range("CurrentFund") = x
    Sheets("TDIN").Select
    Sheets("TDIN Formulas").Visible = True
    Sheets("TDIN Formulas").Select
     Application.Goto Reference:="TDINCopy1"
        Selection.Copy
        Sheets("TDIN").Select
        Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
            :=False, Transpose:=False
        ActiveCell.SpecialCells(xlLastCell).Select
        ActiveCell.Offset(1, 0).Select
    Sheets("Input").Select
    Range("CurrentFund").Select
    End If
    Next
    
    'Select data for TDIN text file
    Sheets("Input").Select
    Range("A3").Select
    ActiveCell.FormulaR1C1 = "1"
    
    Sheets("TDIN").Select
    Range("A2").Select
    Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
    ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
            , AllowFormattingColumns:=True
    
    
    Sheets("Input").Select
    Range("B7").Select
    ActiveSheet.Protect
    
    'Allow macro process to show while running
    Applicationscreenupdating = True
    
    MsgBox "Your File Has Been Created and Saved as " & Range("SavePath") & "\" & Range("SaveName"), vbInformation
    MsgBox "Open CCH. Once CCH Has Fully Loaded, Click the 'Import Into CCH' Button", vbInformation
    
    Set fso = Nothing
    
    End Sub
    Last edited by bwink88; 02-25-2014 at 12:44 PM.

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