(已编辑)
我相信您将不得不复制每个单元格中的每个属性(希望没有合并的属性,这会导致额外的麻烦),然后删除它的超链接,然后恢复属性。
您可以录制宏以发现所有属性,这里有一些字体和内部示例。要发现您可能需要这样做的其他属性,您必须开始录制宏,选择一些单元格,手动更改该属性,停止录制,并在生成的代码中查看这些属性是什么。
Sub Macro1()
'
' Macro1 Macro
'
Dim Cell As Range
Dim SelectedRange As Range
Set SelectedRange = ActiveSheet.Range("A1:K50")
Dim Rows As Integer
Dim Columns As Integer
Dim i As Integer
Dim j As Integer
Rows = SelectedRange.Rows.Count
Columns = SelectedRange.Columns.Count
For i = 1 To Rows
For j = 1 To Columns
Set Cell = SelectedRange.Cells(i, j)
Call ClearHyperlinks(Cell)
Next
Next
End Sub
Sub ClearHyperlinks(Cell As Range)
'''''''''' Font Properties''''''''''''''
Dim fName As Variant
Dim fFontStyle As Variant
Dim fSize As Variant
Dim fStrikethrough As Variant
Dim fSuperscript As Variant
Dim fSubscript As Variant
Dim fOutlineFont As Variant
Dim fShadow As Variant
Dim fUnderline As Variant
Dim fThemeColor As Variant
Dim fTintAndShade As Variant
Dim fThemeFont As Variant
With Cell.Font
fName = .Name
fFontStyle = .FontStyle
fSize = .Size
fStrikethrough = .Strikethrough
fSuperscript = .Superscript
fSubscript = .Subscript
fOutlineFont = .OutlineFont
fShadow = .Shadow
fUnderline = .Underline
fThemeColor = .ThemeColor
fTintAndShade = .TintAndShade
fThemeFont = .ThemeFont
End With
''''''''''Interior Properties''''''''''''''
Dim iPattern As Variant
Dim iPatternColorIndex As Variant
Dim iThemeColor As Variant
Dim iTintAndShade As Variant
Dim iPatternTintAndShade As Variant
With Cell.Interior
iPattern = .Pattern
iPatternColorIndex = .PatternColorIndex
iThemeColor = .ThemeColor
iTintAndShade = .TintAndShade
iPatternTintAndShade = .PatternTintAndShade
End With
''''''''''''' Number Format '''''''''
Dim NumberFormat As Variant
NumberFormat = Cell.NumberFormat
'''''''''''''' Delete Hyeperlinks
Cell.Hyperlinks.Delete
''''''''''''''''''Restore properties'''''''''''''''
Cell.NumberFormat = NumberFormat
With Cell.Font
.Name = fName
.FontStyle = fFontStyle
.Size = fSize
.Strikethrough = fStrikethrough
.Superscript = fSuperscript
.Subscript = fSubscript
.OutlineFont = fOutlineFont
.Shadow = fShadow
.Underline = fUnderline
.ThemeColor = fThemeColor
.TintAndShade = fTintAndShade
.ThemeFont = fThemeFont
End With
With Cell.Interior
.Pattern = iPattern
.PatternColorIndex = iPatternColorIndex
.ThemeColor = iThemeColor
.TintAndShade = iTintAndShade
.PatternTintAndShade = iPatternTintAndShade
End With
End Sub
(原创)您可以简单地手动或自动复制所有内容(包括超链接)。在粘贴这些内容的新工作表中,只需使用以下命令删除超链接:
选择.超链接.删除