Formula Error N/A

bhandari

Active Member
Joined
Oct 17, 2017
Messages
359
Code:
    With Sheets("Model")
        For X = 5 To .Cells(5, Columns.Count).End(xlToLeft).Column
            If Len(.Cells(5, X).Value) > 0 Then
                On Error Resume Next
                Set wks = Sheets(CStr(.Cells(5, X).Value))
                On Error GoTo 0
                If wks Is Nothing Then
                    Sheets("General").Visible = True
                    Sheets("Shapes").Visible = True
                    Sheets("General").Copy after:=Sheets(Sheets.Count)
                    Sheets(Sheets.Count).Name = .Cells(5, X).Value
                    Set wks = ActiveSheet
[COLOR=#ff0000]                    MyFormulas = Array("='" & wks.Name & "'!$BB$105", "", "='" & wks.Name & "'!$BB$109", "='" & wks.Name & "'!$BB$124", "='" & wks.Name & "'!$BB$143", "='" & wks.Name & "'!$BB$115", "", "='" & wks.Name & "'!$BB$211", "='" & wks.Name & "'!$BB$151+$BB$152", "='" & wks.Name & "'!$BB$157", "", "='" & wks.Name & "'!$BB$167", "='" & wks.Name & "'!$BB$169", "='" & wks.Name & "'!$BB$168", "='" & wks.Name & "'!$BB$160", "='" & wks.Name & "'!$BB$183", "='" & wks.Name & "'!$BB$193", "='" & wks.Name & "'!$BB$187", "", "='" & wks.Name & "'!$BB$192", "='" & wks.Name & "'!$BB$158", "='" & wks.Name & "'!$BB$159", "='" & wks.Name & "'!$BB$200", "='" & wks.Name & "'!$BB$195", "='" & wks.Name & "'!$BB$203", "='" & wks.Name & "'!$BB$196", "='" & wks.Name & "'!$BB$199", "='" & wks.Name & "'!$BB$212*25")
                    .Range("A9").Offset(, X - 1).Resize(121, 1).Formula = Application.Transpose(MyFormulas)[/COLOR]
                Else
                    MsgBox "Sheets: " & .Cells(5, X).Value & vbCrLf & vbCrLf & "Already exists!", vbExclamation, "Sheet Exists"
                End If
            End If
            ActiveSheet.Protect Password:="pluffy", userinterfaceonly:=True
            Dim shape As shape
            For Each shape In ActiveSheet.Shapes
              shape.Locked = True
            Next
            Set wks = Nothing
            Sheets("General").Visible = xlSheetVeryHidden
            Sheets("Shapes").Visible = xlSheetVeryHidden

            
        Next X
    End With

Looking for Correction Help in my code
i have given Red Color in code, iam getting N/A in my sheet after 32 rows
Can U please Figure it out to get the formula in my Model sheet

This code Working in another sheet
Code:
[COLOR=#ff0000]                    MyFormulas = Array("='" & wks.Name & "'!$O$103", "", "='" & wks.Name & "'!$O$115", "='" & wks.Name & "'!$O$124", "='" & wks.Name & "'!$O$132", "='" & wks.Name & "'!$O$146", "", "='" & wks.Name & "'!$O$157", "='" & wks.Name & "'!$O$161", "='" & wks.Name & "'!$O$162", "", "='" & wks.Name & "'!$O$179", "='" & wks.Name & "'!$O$181", "='" & wks.Name & "'!$O$182", "='" & wks.Name & "'!$O$188", "='" & wks.Name & "'!$O$194", "='" & wks.Name & "'!$O$198", "='" & wks.Name & "'!$O$203", "", "='" & wks.Name & "'!$O$208", "='" & wks.Name & "'!$O$209", "='" & wks.Name & "'!$O$210", "='" & wks.Name & "'!$O$216", "='" & wks.Name & "'!$O$221", "='" & wks.Name & "'!$O$228", "='" & wks.Name & "'!$O$233", "='" & wks.Name & "'!$O$239", "='" & wks.Name & "'!$O$242", "='" & wks.Name & "'!$O$245", "='" & wks.Name & "'!$O$167", "='" & wks.Name & "'!$O$168", "=1")
                    .Range("A9").Offset(, X - 1).Resize(32, 1).Formula = Application.Transpose(MyFormulas)[/COLOR]
 
Last edited:

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN

Forum statistics

Threads
1,216,179
Messages
6,129,329
Members
449,502
Latest member
TSH8125

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