0
我試圖刪除隱藏的Names
,但有一個規則,我選擇隱藏的Name
什麼不能刪除。試圖通過選擇刪除隱藏的名字excel宏
使用Microsoft提供的支持的代碼我設法讓在記錄表的名稱 的列表,並添加一列,當我進入1
旁邊我要不要刪除名字,當我將其留空你希望它刪除名稱。從Microsoft支持
這裏是我的代碼:
Sub clean_names()
Application.ScreenUpdating = False
On Error Resume Next
Set nms = ActiveWorkbook.Names
MsgBox (nms.Count)
For R = 1 To nms.Count
Name_Name = nms(R).Name
Name_Referance = nms(R).RefersTo
'###########ActiveWorkbook.Names(Name_Name).Delete
'ActiveWorkbook.nms(R).Delete
Sheets("LOG").Cells(R + 1, 1).Value = Name_Name
Sheets("LOG").Cells(R + 1, 2).Value = "'" + Name_Referance
'Application.StatusBar = R
Next R
'Application.StatusBar = False
Application.ScreenUpdating = True
End Sub
'================================================================
Sub DelNames()
Dim xName As Variant
Dim Indx As Integer
Dim Vis As Variant
Cells(2, 1).Select
If (ActiveCell = "") Then Exit Sub
Indx = 1
Do
If (ActiveCell.Offset(Indx, 2) = "") Then
xName = ActiveCell.Offset(Indx, 0).Value
If xName.Visible = True Then
Vis = "Visible"
Else
Vis = "Hidden"
End If
xName.Delete
End If
Indx = Indx + 1
Loop While Len(ActiveCell.Offset(Indx, 0))
End Sub
我怎樣才能讓這段代碼的工作?
@Tal Kuce你試過上面我的代碼?如果它爲你工作,標記爲「答案」,這就是我們如何在SO上做的事情。人們提出問題,一旦他們得到答案,他們通過標記爲「答案」 –