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: