"天道無常" 來函:
Post by 天éç¡å¸¸if ActiveCell.Hyperlinks.Count <> 0
感謝大大的提點...小弟感激不盡
嗯...現將修改後的碼舖上來,僅供有同類問題的人參考
Attribute VB_Name = "清除謎之超聯結"
Sub 清除謎之超聯結()
清除欄數 = InputBox("清除欄數:", "左右為欄", 0)
清除列數 = InputBox("清除列數:", "上下為列", 0)
If 清除列數 <> 0 And 清除欄數 <> 0 Then
For I = 1 To 清除列數
For J = 1 To 清除欄數
'MsgBox (I & "." & J & ":" & Cells(I, J).Hyperlinks.Count)
If Cells(I, J).Hyperlinks.Count <> 0 Then
A01 = Cells(I, J).Interior.ColorIndex
A02 = Cells(I, J).Font.Name
A03 = Cells(I, J).Font.FontStyle
A04 = Cells(I, J).Font.Size
A05 = Cells(I, J).Font.Strikethrough
A06 = Cells(I, J).Font.Superscript
A07 = Cells(I, J).Font.Subscript
A08 = Cells(I, J).Font.OutlineFont
A09 = Cells(I, J).Font.Shadow
A10 = Cells(I, J).Font.Underline
A11 = Cells(I, J).Font.ColorIndex
B01 = Cells(I, J).Borders(xlEdgeLeft).LineStyle
B02 = Cells(I, J).Borders(xlEdgeLeft).Weight
B03 = Cells(I, J).Borders(xlEdgeLeft).ColorIndex
B04 = Cells(I, J).Borders(xlEdgeTop).LineStyle
B05 = Cells(I, J).Borders(xlEdgeTop).Weight
B06 = Cells(I, J).Borders(xlEdgeTop).ColorIndex
B07 = Cells(I, J).Borders(xlEdgeBottom).LineStyle
B08 = Cells(I, J).Borders(xlEdgeBottom).Weight
B09 = Cells(I, J).Borders(xlEdgeBottom).ColorIndex
B10 = Cells(I, J).Borders(xlEdgeRight).LineStyle
B11 = Cells(I, J).Borders(xlEdgeRight).Weight
B12 = Cells(I, J).Borders(xlEdgeRight).ColorIndex
Cells(I, J).Hyperlinks.Delete
Cells(I, J).Interior.ColorIndex = A01
Cells(I, J).Font.Name = A02
Cells(I, J).Font.FontStyle = A03
Cells(I, J).Font.Size = A04
Cells(I, J).Font.Strikethrough = A05
Cells(I, J).Font.Superscript = A06
Cells(I, J).Font.Subscript = A07
Cells(I, J).Font.OutlineFont = A08
Cells(I, J).Font.Shadow = A09
Cells(I, J).Font.Underline = A10
Cells(I, J).Font.ColorIndex = A11
Cells(I, J).Borders(xlEdgeLeft).LineStyle = B01
Cells(I, J).Borders(xlEdgeLeft).Weight = B02
Cells(I, J).Borders(xlEdgeLeft).ColorIndex = B03
Cells(I, J).Borders(xlEdgeTop).LineStyle = B04
Cells(I, J).Borders(xlEdgeTop).Weight = B05
Cells(I, J).Borders(xlEdgeTop).ColorIndex = B06
Cells(I, J).Borders(xlEdgeBottom).LineStyle = B07
Cells(I, J).Borders(xlEdgeBottom).Weight = B08
Cells(I, J).Borders(xlEdgeBottom).ColorIndex = B09
Cells(I, J).Borders(xlEdgeRight).LineStyle = B10
Cells(I, J).Borders(xlEdgeRight).Weight = B11
Cells(I, J).Borders(xlEdgeRight).ColorIndex = B12
End If
Next J
Next I
MsgBox ("「謎之超聯結」與「不是謎之超聯結」都清除掉了...")
End If
End Sub