Excel超链接宏

时间:2021-03-17 22:40:24

标签: excel image hyperlink

我目前有一个用于将照片链接到我的电子表格的宏。 我目前遇到宏“错误 5”的一些问题,尤其是“ActiveSheet...”。

有人可以帮忙吗?

Sub hyperlink_rowselect()
    ' 2 October 2015
    ' hyperlink Macro
    '

    'Calls RowSelection form to allow start and finish rows to be selected.
    RowSelection.Show

    Counts_R = RowSelection.StartRow.Value
    Counts_G = 7 'Selection.Column
    Anchor_G = 7 'Selection.Column

    Do Until Counts_R = RowSelection.FinishRow.Value + 1 Or Cells(Counts_R, Anchor_G).Value = ""

        Do Until Cells(Counts_R, Counts_G).Value = ""
            ActiveSheet.Hyperlinks.Add Anchor:=Cells(Counts_R, Counts_G), Address:="_photos\" & Cells(5, 7).Value & Cells(Counts_R, Counts_G).Value & ".JPG", TextToDisplay:=Cells(Counts_R, Counts_G).Value
        Loop            'Counts Loop

        Counts_R = Counts_R + 1
        Counts_G = Anchor_G

    Loop

    RowSelection.StartRow.Value = ""
    RowSelection.FinishRow.Value = ""

    ActiveWorkbook.Save
End Sub

0 个答案:

没有答案