Consulting

Results 1 to 3 of 3

Thread: Code VBA Excel slowly

  1. #1

    Code VBA Excel slowly

    [vba]Sub ProcessData()
    Range("B2").Select
    ActiveCell.FormulaR1C1 = "=SUMIFS(Database!C[10],Database!C3,Result!RC1)"
    Range("B2").Select
    Selection.AutoFill Destination:=Range("B2:B14"), Type:=xlFillDefault
    Range("B2:B14").Select
    Selection.Resize(13, 280).FillRight
    Range("A1").Activate
    End Sub[/vba]
    code vba very slow in the information sheet that will be about 100,000 rows.
    Can be improved to run faster than me.

  2. #2
    Try this and see if this is better.

    [VBA]Sub ProcessData()

    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual

    Range("B2").Resize(13, 280).FormulaR1C1 = "=SUMIFS(Database!C[10],Database!C3,Result!RC1)"
    Range("A1").Activate

    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True

    End Sub[/VBA]
    Feedback is the best way for me to learn


    Follow the Armies

  3. #3
    Knowledge Base Approver VBAX Wizard
    Joined
    Apr 2012
    Posts
    5,646
    Avoid any 'Select' or 'Activate' in VBA

Posting Permissions

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