Readdy Write  
0,00 €
Your View Money
Views: Count
Self 20% 0
Your Content 60% 0

Users by Links 0
u1*(Content+Views) 10% 0
Follow-Follower 0
s2*(Income) 5% 0

Count
Followers 0
Login Register as User

Excel vba Makro Code: alle Namens-Variablen löschen

07.03.2019 (👁270)


Das folgende vba Script löscht alle Names-Variablen in einer Excel Datei.

Anbei ist natürlich eine Download Version zum testen

Vba Macro Code:

        Dim varName As Name

        Set varName = wb.Names(1)

        varName.Delete

 

Microsoft Excel Names Variablen

Vba Code

Option Explicit

Public Sub Names_loeschen_Arbeitsmappe(ByRef wb As Workbook)

    '-----------------< Names_loeschen_Arbeitsmappe() >-----------------

    '----< Sheets ermitteln >----

    Dim ws As Worksheet

    '--< @Loop: alle Sheets >--

    For Each ws In wb.Sheets

        If ws.Visible = xlSheetVisible Then

            If ws.Range("A1").Value = "96dpi" Then

                Application.StatusBar = Now & " Names löschen->" & ws.Name

                Names_loeschen_in_Blatt wb, ws

            End If

        End If

    Next

    '--< @Loop: alle Sheets >--

 

    Application.StatusBar = Now & " Fertig: " & wb.Name & " Names löschen"

    '-----------------</ Names_loeschen_Arbeitsmappe() >-----------------

End Sub

Public Sub Names_loeschen_in_Blatt(ByVal wb As Workbook, ByVal ws As Worksheet)

    '-----------------< Names_loeschen_in_Blatt() >-----------------

    '*löscht alle Names

    ws.Activate

   

    '----< Sheets ermitteln >----

    Application.ScreenUpdating = False

    Application.Calculation = xlCalculationManual

    '----< @Loop: Names >----

   

    Dim iName As Integer

    For iName = wb.Names.Count To 1 Step -1

        '-< Loeschen >-

        Dim varName As Name

        Set varName = wb.Names(iName)

        If varName.Visible = True Then

            Application.StatusBar = Now & " link löschen : " & varName.Name

            If Not varName.Name Like "*!Print_Area*" Then

                varName.Delete

            End If

        End If

        '-</ Loeschen >-

    Next

    '----</ @Loop: Names >----

   

    '< close >

    Application.DisplayAlerts = True

    Application.ScreenUpdating = True

    Application.Calculation = xlCalculationAutomatic

    '</ close >

   

    '-----------------</ Names_loeschen_in_Blatt() >-----------------

End Sub