yesterday I posted about this problem because I didn't know an array had a limit of 255 characters. Today I've been trying for the last 9 hours to break it down as shown here:
Overcoming the 255 char. limit for formulaArray in Excel VBA and on google search for other posts doing exactly the same thing.
I followed the instructions about in order for the trick to work, you need to write complete formulas, but still haven't figured it out.
Dim TR As Double
Dim TC As Double
Dim Formula1 As String
Dim Formula2 As String
Dim Formula3 As String
Dim Rows2Copy As Integer
Dim PValue As String
Dim str As String
str = OpenBook.Sheets(1).Cells(2, 1).Value
PValue = Mid(str, 20, 2)
Rows2Copy = (PValue / 5) - 10
TR = ActiveWorkbook.Sheets(2).Cells(22 + Rows2Copy, 2).Value
TC = WorksheetFunction.Match("*" & "W" & Cells(2, 3) & "*", Worksheets(1).Range("5:5"), 0)
For j = 300 To TotalRows * 300 Step 300
With ActiveWorkbook.Sheets(2).Range("B24")
Formula1 = "=LOOKUP(2,1/('Raw Data'!R11C" & TC & ":R1048576C" & TC & "=VLOOKUP(INDEX('Raw Data'!R" & TR - j & "C1:R" & TR - j + 300 & "C1,MATCH(MIN(+FX2),+FX2,0)),'Raw Data'!R11C1:R1048576C131,+FX3,FALSE)),'Raw Data'!R11C1:R1048576C1)"
Formula2 = "ABS('Raw Data'!R" & TR - j & "C" & TC & ":R" & TR - j + 300 & "C" & TC & "-((R[1]C[2]-0.05)*R7C4))"
Formula3 = "MATCH(""*""&""W""&R2C3&""*"",'Raw Data'!R5,0)"
.FormulaArray = Formula1
.Replace "+FX2", Formula2, xlPart
.Replace "+FX3", Formula3, xlPart
End With
Next j
In the Picture, the Load case is extracted as well as the maximum force applied, the first thing is based on W Tested, it looks for the column containing that data, then returns the maximum value on "Applied Load" Column and finally returns the ID of that value. The applied load value represents 75.7% The next step is based on a 300 upward row range from the starting position (in this case row 44834) find the closest match to 70% of the initial test and then return the value, then with 65% then 60% and so on until 10%. Everything else will populate with those values and create the intended charts. All I'm missing is this formula for it to work
Thank you! I really appreciate the help!