Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Aug 2001
    Location
    USA
    Posts
    122
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    The following code copies several rows of formulas and pastes the values in the row above.

    Code:
    Dim vSourceCells As Integer
    Dim vDestinationCells As Integer
        
        With Application
            .ScreenUpdating = False
            .DisplayAlerts = False
        End With
        
        'Copies income section
        For vSourceCells = 12 To 42 Step 3
            vDestinationCells = vSourceCells - 1
            Range(Cells(vSourceCells, 2), Cells(vSourceCells, 6)).Copy
            Range(Cells(vDestinationCells, 2), Cells(vDestinationCells, 5)).PasteSpecial xlPasteValues
        Next vSourceCells
        
        'Copies expense section
        For vSourceCells = 47 To 77 Step 3
            vDestinationCells = vSourceCells - 1
            Range(Cells(vSourceCells, 2), Cells(vSourceCells, 6)).Copy
            Range(Cells(vDestinationCells, 2), Cells(vDestinationCells, 5)).PasteSpecial xlPasteValues
        Next vSourceCells
        
        Range("B9").Activate
         
        With Application
            .DisplayAlerts = True
            .ScreenUpdating = True
        End With
    When the code runs, I can still see the cell pointer moving down the sheet.

    I've turned off screenupdating in the past, and thought that the screen 'froze' until screenupdating was set to true.

    Am I remembering wrong, or is screenupdating not working on my computer?

    Thanks,

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    6,487
    Thanks
    212
    Thanked 851 Times in 783 Posts
    Your memory is just fine!

    Could you upload the workbook so we can play with it?

    RG
    May the Forces of good computing be with you!

    RG

    VBA Rules!

    My Systems: Desktop Specs
    Laptop Specs


  3. #3
    2 Star Lounger
    Join Date
    Aug 2001
    Location
    USA
    Posts
    122
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Here is the a modified version of the file. {The original file contained some sensitive information.}

    As I was preparing this file on my home computer, I tested the macro (which runs on the sheet's activate event) on both Excel 2003 and Excel 2007 and it worked like I expected.

    My conclusion is that there is some Excel setting on my work computer that is different than my home computer.

    Thanks,
    [attachment=88596:Book1.xls]
    Attached Files Attached Files

  4. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    6,487
    Thanks
    212
    Thanked 851 Times in 783 Posts
    Works just fine on my Win 7 / Office 2003 SP3 setup also.

    I can't imagine what setting they could have changed except for the security level and that would prevent the VBA from running at all.

    RG
    May the Forces of good computing be with you!

    RG

    VBA Rules!

    My Systems: Desktop Specs
    Laptop Specs


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •