+ Reply to Thread
Results 1 to 5 of 5

Excel 2007 : Freezing column

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-23-2009
    Location
    Serbia
    MS-Off Ver
    Excel 2007
    Posts
    180

    Freezing column

    Hello,

    Could somebody give me solution for case where I have one column with results of calculation, after erasing columns which are part of calculations result should be remain in results column(something like freezing result, progressive entry , see attached file).As I know this possible doing over macro but I’m not familiar with macro, are this possible do in Excel 2007?

    Thanks for yours effort...
    Attached Files Attached Files

  2. #2
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Freezing column

    Try this
    Sub PreserveResults()
        Dim LastRow As Long
        
        LastRow = Range("A" & Rows.Count).End(xlUp).Row
    
        With Range("C:C")
            .Copy
            .PasteSpecial Paste:=xlPasteValues
        End With
        Range("A2:B" & LastRow) = 0
        
        Application.CutCopyMode = False
        Range("A2").Select
    End Sub

    N.B.
    with your sample workbook you should unmerge the cells in row 1 first.

    Hope this helps
    If you need any more information, please feel free to ask.

    However,If this takes care of your needs, please select Thread Tools from menu above and set this topic to SOLVED. It helps everybody! ....

    Also
    اس کی مدد کرتا ہے اگر
    شکریہ کہنے کے لئے سٹار کلک کریں
    If you are satisfied by any members response to your problem please consider using the small Star icon bottom left of their post to show your appreciation.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Freezing column

    @Marcol, I think OP is saying that C should be the Sum of: A, B & prior sum (should it exist).

    Of course the issue becomes identifying when C should recalculate (so as to avoid potential for double counting A & B)

  4. #4
    Forum Guru (RIP) Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    7,216

    Re: Freezing column

    Maybe this then?
    Sub PreserveResults()
        Dim LastRow As Long
        
        LastRow = Range("A" & Rows.Count).End(xlUp).Row
        If Range("F2") = "" Then
            Range("F1") = "Grand Total"
            Range("F2").Formula = "=SUM($D2:E2)"
            Range("F2:F" & LastRow).FillDown
        Else
            Columns("E:E").Insert
        End If
        Range("C2:C" & LastRow).Copy
        Range("E2").PasteSpecial Paste:=xlPasteValues
        
        Range("A2:B" & LastRow) = 0
        
        Application.CutCopyMode = False
        Range("A2").Select
    End Sub

    Fill in values in Columns A & B then run macro.
    Repeat as required.

    Hope this helps
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    12-23-2009
    Location
    Serbia
    MS-Off Ver
    Excel 2007
    Posts
    180

    Re: Freezing column

    Thanks all guys for answers, especially thanks to Marcol, but when I open final version of the document “Preserve results” I got nothing, I leave space than I did something wrong because I’m not so familiar with macro functions, actually my question is how will be activate one macro function as in my example.

    Thanks a lot, you are a great.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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