اخواني الاعزاء تحية طيبه وجدت في احد المنتديات الاجنبيه الكود الرائع الموضح ادناه والذي يقوم باخفاء المعادلات واظهارها وحين قمت بتطبيقه على بعض الملفات نجح في اخفاء بعض معادلاتها وظهرت في ملفات اخرى رسالة تتضمن الرقم (400) فقط ، انا بحاجة ماسة لهذا الكود كيف يمكن معالجة الخلل وماذا تعني الرساله مع امتناني وشكري .
Private Sub CommandButton1_Click()
Call Updater
End Sub
Sub HideFormulas()
Const NamePrefix As String = "Formula_"
Dim myColl As New Collection
Dim oneCell As Range, oneName As Name
Dim nameFormula As String
Dim nameCount As Long
Dim workingRange As Range
Dim TheSheet As Worksheet
Set TheSheet = ActiveSheet
Call UnhideSheetFormulas(TheSheet)
With TheSheet
If Not (.Cells.SpecialCells(xlCellTypeFormulas) Is Nothing) Then
For Each oneCell In .Cells.SpecialCells(xlCellTypeFormulas)
.Parent.Names.Add Name:="temp", RefersToR1C1:=oneCell.FormulaR1C1
oneCell.FormulaR1C1 = Names("temp").RefersToR1C1
Next oneCell
.Parent.Names("temp").delete
For Each oneCell In .Cells.SpecialCells(xlCellTypeFormulas)
nameFormula = oneCell.FormulaR1C1
For Each oneName In TheSheet.Names
If oneName.RefersToR1C1 = nameFormula Then
oneCell.FormulaR1C1 = "=" & Mid(oneName.Name, InStr(oneName.Name, "!") + 1)
GoTo NextCell
End If
Next oneName
nameCount = nameCount + 1
Set oneName = .Names.Add(Name:=NamePrefix & nameCount, RefersToR1C1:=nameFormula)
oneCell.FormulaR1C1 = "=" & Mid(oneName.Name, InStr(oneName.Name, "!") + 1)
oneName.Visible = False
NextCell:
Next oneCell
End If
End With
End Sub
Sub ShowAllNames()
Dim oneName As Name
For Each oneName In ActiveSheet.Parent.Names
oneName.Visible = True
Next oneName
End Sub
Sub UnHideFormulas()
UnhideSheetFormulas ActiveSheet
End Sub
Private Sub UnhideSheetFormulas(TheSheet As Worksheet)
Dim oneCell As Range, oneName As Name
With TheSheet
On Error Resume Next
For Each oneCell In .Cells.SpecialCells(xlCellTypeFormulas)
oneCell.FormulaR1C1 = .Names(Mid(oneCell.FormulaR1C1, 2)).RefersToR1C1
Next oneCell
On Error GoTo 0
For Each oneName In .Names
If oneName.Name Like "*" & NamePrefix & "*" Then
oneName.delete
End If
Next oneName
End With
End Sub