Splitting Formula - Better way?

spydey

Active Member
Joined
Sep 19, 2017
Messages
314
Office Version
  1. 2013
Platform
  1. Windows
So I have a number of formulas that are currently in-cell.

I am converting the workbook to VBA and so would like to use the .FormulaArray and .FormulaR1C1 to place the formula in the columns.
However, I have found that those two pieces of code have a 255 character limit of what they can place in the cell.

I did some research and found that I could input a simple formula, kind of like the "shell" of the formula, with "place holders" in it, then do a .replace and replace each place holder with the correct section of the formula.

The issue I am having is that I need to follow syntax and it gets kind of confusing when my formula is massive.

Is there a better way to do this?

Would actually coding out the formula programmatically be better than simply inserting the formula into the cell?

What kind of performance gain/loss might I have?

Any input is very help and much appreciated!!

Thanks!!

-Spydey
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
There are a couple things I've done in the past. One is to have a hidden row of formulas that I copy down. The other is to create the formulas from scratch in one cell and then copy it down using something like this. You can specify multiple columns in the copy process. Does that help

Code:
Sub Formulas()
  Dim Cel As Range
  
  Set Cel = Range("A1")
  Cel.Value = "=C1+B1"
  Range("A1:A1000").Formula = Cel.Formula


End Sub
 
Upvote 0
Make sure you:

Code:
Application.Calculation = xlCalculationManual
at the beginning and
Code:
Application.Calculation = xlCalculationAutomatic
at the end
 
Upvote 0

Forum statistics

Threads
1,223,099
Messages
6,170,108
Members
452,302
Latest member
TaMere

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