Formula not calculating after VBA. Need to click each cell

Akbarov

Active Member
Joined
Jun 30, 2018
Messages
347
Office Version
  1. 365
Platform
  1. Windows
Hello,

I used
screenupdating = false
Application.Calculation = xlCalculationManual

Because code was working very slow. Now it works very fast but not calculating cells. I need to click each cell to calculate result.
Any solution please? I tried replace "=" with "=" but still no luck..

VBA Code:
Option Explicit

Sub Sample()
    
    Dim ws As Worksheet
    Dim ColName As String
    Dim ColNumber As Long
    Dim i As Long
    Dim CpyFrom As range
    Dim Cell As range
    Dim ColCounter As Integer
    Dim LR As Long
    
    
    'Turn of screenupdating to improve performance
    'Dim savedScreenUpdating As Boolean
    'savedScreenUpdating = Application.ScreenUpdating
    Application.ScreenUpdating = False
    
    
    'Make Excel calculation manual to improve performance
    'Dim savedCalcMode As XlCalculation
    'savedCalcMode = Application.Calculation
    Application.Calculation = xlCalculationManual
    
    '~~> Sheet name to format
    Set ws = Sheets("DATA TO FORMAT (2)")
    ColCounter = 1

    'for each rows
    Set CpyFrom = ws.range("L10003:L10542")
    
    ColName = ws.range("B9").Value2
    ColNumber = range(ColName & 1).Column
    
    '~~> Here is the loop from 0 to col number
    For i = 0 To ColNumber - 13
    
     For Each Cell In CpyFrom
        If Cell.Value <> vbNullString Then
            Cell.Offset(0, i + 1).Value = Cell.Offset(0, 1).Formula2R1C1
        End If
    Next Cell
    Next i
    
    Application.Calculation = xlCalculationAutomatic
    Application.ScreenUpdating = True
    

    range(Cells(10003, 12), Cells(10542, Rows("10003:10542").Find("*", , xlFormulas, , 2, 2).Column)).Replace "=", "="
    
End Sub
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top