@Rick
Although the OP did't ask for any flexibility, I think it's the most flexible one:
If you 'abhorr' square brackets, useCode:Sub M_snb() Range("C9:F10").Name = "snb1" Range("I9:L10").Name = "snb2" [snb1] = [if(snb1*snb2>0,int((snb1+snb2)/2),if(snb1&snb2="","",snb1+snb2))] End Sub
@SteveCode:Range("snb1") = Evaluate("if(snb1*snb2>0,int((snb1+snb2)/2),if(snb1&snb2="""","""",snb1+snb2))")
Avoid activate in VBA.
The use of 'Let' is redundant in VBA.
I tried to incorporate my suggestion into your snippet:
Code:Sub Freeze() Dim Tt As Long Dim Rb As Integer Tt = Application.Range("WHERE15").Value Rb = Application.Range("reachBACK").Offset(0, -1).Value If Rb > Tt - 3 Then Rb = Tt - 4 If Rb <> 0 Then Application.ScreenUpdating = False Application.Calculation = xlCalculationManual With Sheets("INVESTOR INTERFACE") .Cells(Tt - Rb, 128).Resize(Rb, 3).Name = "snb1" .Range("snb1").Offset(, 13).Name = "snb2" [snb1] = [if(snb1*snb2>0,int((snb1+snb2)/2),if(snb1&snb2="","",snb1+snb2))] If Tt > 12 Then .Range("snb1").Offset(-11, 0).Resize(24, 3).ClearContents End With Application.Calculation = xlCalculationAutomatic End If End Sub




Reply With Quote
Bookmarks