添加数据或sorting列表后维护超链接

我有几百个标题的列表,每个条目有几列(即名称,date等)。 在这些名字中,我添加了只是说“A”,“B”,“C”等等的条目,因为当滚动文档,查找特定名称,知道在哪里 – 例如 – “H”开始。

随着列表的增长,我在文档的顶部添加了超链接,以便能够跳转到A / B / C /等条目。 但是,当添加新数据并对其进行sorting时,或者按date或其他方式对列表进行sorting时,超链接“转到:A”(作为示例)将保持链接到原始单元格A1 – 尽pipe该单元格的数据(实际的文字“A”)现在在A42。

有没有办法通过sorting和[主要]添加新数据来维护超链接?

A1中的公式是=HYPERLINK($I1,"Go to: "&H1)以便适当复制。

修改了SO17535313的例子

(= MATCH'不喜欢'与search字母相同范围的超链接单元格。)

或者在Row1中(但仍在一个新的ColumnA中)并复制下来,而不需要ColumnH:I:

 =HYPERLINK("[SO17535313.xlsx]Sheet1!"&"B"&MATCH(CHAR(64+ROW()),B:B,0),"Go to: "&CHAR(64+ROW())) 
  • 将Excel电子表格保存为“网页”(而不是“单个文件网页”)。
  • 在Excel中打开“网页”版本。
  • 把它分类。
  • 将其另存为Excel电子表格。

每个链接将保存在适当的单元格中。

Excel中有一个与超链接和sorting有关的公认错误。

KB214328:在Excel中对包含这些超链接的单元格进行sorting后,超链接被删除或无效

我应该注意到,在我的情况下,我正在超链接到Excel以外的文档(ProjecWise)。

我的工作是将所有超链接作为文本存储在一列中,并使用Excel Hyperlink()函数为另一列中的每一行生成超链接。 当您想从外部源(如浏览器)粘贴超链接时,请select该单元格,然后将链接粘贴到function区下面的function框中,而不是直接粘贴到单元格中。 这将给你的文本,而不是在单元格中创build超链接对象。

我完全不了解这个问题,但是从我对Excel处理超链接的新理解中,单元格中的超链接以某种方式链接到表单对象上的一组超链接。 当您对工作表中的行进行sorting时,工作表超链接引用开始返回错误的引用。 我无法find工作表超链接引用唯一的“句柄”,但注意到h.Parent.Top正在改变,因为我sorting。

 Public Sub ShowSheetHyperlinks() ' Use this to demonstrate the issue acknowledged here: http://support.microsoft.com/kb/214328 ' Add some hyperlinks in a column of a spreadsheet and random values in a column next to it. ' Run this routine. Then sort the values by the first or second column and run this routine again. ' You may have to do this a few times, and/or copy and paste your hyperlink cells to other cells. ' Eventually you will see that the results change after the two columns are sorted. ' (You may not need two columns, but it may help to randomize the sorting.) Dim h As Hyperlink Debug.Print "Hyperlinks on " & ActiveSheet.Name & ": " & ActiveSheet.Hyperlinks.Count For Each h In ActiveSheet.Hyperlinks ' After you sort the list of hyperlinks, you will notice the values in the ' three columns below. I am truncating the address to just see the last 20 characters. Debug.Print h.TextToDisplay, h.Parent.Top, Right(h.Address, 20) Next End Sub