Syntax Error While Recording a Macro

mucah!t

Well-known Member
Joined
Jun 27, 2009
Messages
593
Hello all,

Aladin helped me out with the following Formula.

Code:
=SUM(IF((WERKBLAD!B6:B1000>=AD2)*(WERKBLAD!B6:B1000<=AE2)*(WERKBLAD!D4:IV4=AF2),IF(WERKBLAD!D6:IV1000="C",8,IF(ISNUMBER(SUBSTITUTE(WERKBLAD!D6:IV1000,"C",0)+0),SUBSTITUTE(WERKBLAD!D6:IV1000,"C",0)+0))))

The problem with it is, that every cell change in my workbook takes now about 15 seconds calculating time.

I thought by putting the formula in a macro and running it only when neccessary to circumvent this problem.

However I can't record the formula, as it keeps on giving a "syntax error in visual basic".

Do you guys know of a solution?
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
And this doesn't work either.
Code:
Application.ScreenUpdating = False
    'Application.ReferenceStyle = xlR1C1
    Dim theFormulaPart1 As String
    Dim theFormulaPart2 As String
    theFormulaPart1 = "==SUM(IF(WERKBLAD!D4:IV4=AF2,IF(WERKBLAD!B6:B1000>=AD2,IF(WERKBLAD!B6:B1000<=AE2,IF(WERKBLAD!D6:IV1000=""V"",1)))))+" & _
                          "X_X_X()"
 
    theFormulaPart2 = "SUM(IF(WERKBLAD!D4:IV4=AF2,IF(WERKBLAD!B6:B1000>=AD2,IF(WERKBLAD!B6:B1000<=AE2,(WERKBLAD!D6:IV1000)))))/8"
 
    With ActiveSheet.Range("AG2")
        .FormulaArray = theFormulaPart1
        .Replace "X_X_X()", theFormulaPart2
        '.NumberFormat = "mmm dd"
    End With
   ' Application.ReferenceStyle = xlA1
 
Upvote 0

Forum statistics

Threads
1,224,602
Messages
6,179,845
Members
452,948
Latest member
UsmanAli786

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