I have 2 sheets. In one of the sheet (sheet1) I have 1 hyperlink with file address \\sii\\picture\\as.jpg hyperlink is named "LINK". I need to re create this hyperlink without "formats" (background color and any of them). I need to do this using VBA.
when I try this I get an error
Localization = Sheets("Sheet1").Range("A1").Hyperlinks(1).Address
Sheets("Sheet2").Hyperlinks.Add Anchor:=Sheets("sheet2").Cells(2, 2), Address:=Localization, TextToDisplay:="LINK"
if I make something like
sheets("Sheet1").select
range (Cells(1,1)).select
SELECTION.Copy
sheets("Sheet2").select
range (Cells(1,1)).select
Sheets("Sheet2").Paste
I get good hiperlink but this hiperlink have formated background and any things from first sheet, and my screen is blinking because excel is jumping between sheet1 and sheet2
This should work for you. You may have to amend it to fit withing your existing code
Sub Main()
Dim rngDest As Range
Dim rngSource As Range
Dim wkshtSource As Worksheet
Dim wkshtDest As Worksheet
Dim urlSource As String
' Set Worksheet and Range variables for easy reference
Set wkshtSource = ActiveWorkbook.Sheets("Sheet1")
Set wkshtDest = ActiveWorkbook.Sheets("Sheet2")
Set rngSource = wkshtSource.Cells(1, 1)
Set rngDest = wkshtDest.Cells(2, 2)
'Gets the address of the hyperlink to copy
urlSource = rngSource.Hyperlinks(1).Address
'Creates Hyperlink on second page
rngDest.Hyperlinks.Add Anchor:=rngDest, Address:=urlSource, TextToDisplay:="Link"
End
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.