Skip to main content

Conas hipearnasc a chóipeáil ó chill amháin go ceann eile in Excel?

Ag ceapadh, tá liosta luachanna agam i gcolún A agus tá hipearnasc difriúil i ngach cill, anois, níl uaim ach na hipearnasc gan chóipeáil gan téacs chuig colún E eile mar a thaispeántar an scáileán a thaispeántar. B’fhéidir nach bhfuil aon bhealach díreach ann chun an post seo a réiteach in Excel, ach anseo, is féidir liom cód VBA a thabhairt isteach chun déileáil leis.

hipearnasc cóipeála doc chuig cill eile 1

Cóipeáil hipearnasc ó chill amháin go ceann eile le cód VBA


mboilgeog cheart gorm saighead Cóipeáil hipearnasc ó chill amháin go ceann eile le cód VBA

Chun na seoltaí hipearnasc a chóipeáil gan an téacs a chur chuig cealla eile, is féidir leis an gcód seo a leanas fabhar a thabhairt duit, mar seo le do thoil:

1. Coinnigh síos an ALT + F11 eochracha a oscailt Microsoft Visual Basic d’Fheidhmchláir fhuinneog.

2. Cliceáil Ionsáigh > Modúil, agus greamaigh an cód seo a leanas sa Modúil Fuinneog.

Cód VBA: cóipeáil hipearnasc ó chill amháin go ceann eile:

Sub CopyHyperlinks()
'Uodateby Extendoffice
    Dim xSRg As Range
    Dim xDRg As Range
    Dim I As Integer
    Dim xAddress As String
    On Error Resume Next
    xAddress = ActiveWindow.RangeSelection.Address
    Set xSRg = Application.InputBox("Please select the original range you want to copy hyperlinks:", "KuTools For Excel", xAddress, , , , , 8)
    If xSRg Is Nothing Then Exit Sub
    Set xDRg = Application.InputBox("Please select the new range you want to paste the hyperlinks only", "KuTools For Excel", , , , , , 8)
    If xDRg Is Nothing Then Exit Sub
    Set xDRg = xDRg(1)
    For I = 1 To xSRg.Count
        If xSRg(I) <> "" And xDRg.Offset(I - 1) <> "" Then
            If xSRg(I).Hyperlinks.Count = 1 Then
                xDRg(I).Hyperlinks.Add xDRg(I), xSRg(I).Hyperlinks(1).Address
            End If
        End If
    Next
End Sub

3. Agus ansin brúigh F5 eochair chun an cód seo a rith, tiocfaidh bosca dialóige amach le cur i gcuimhne duit na cealla a theastaíonn uait na hipearnasc a chóipeáil amháin a roghnú, féach an scáileán:

hipearnasc cóipeála doc chuig cill eile 02

4. Agus ansin cliceáil OK, ansin roghnaigh na cealla nach dteastaíonn uait na hipearnasc a ghreamú ach i mbosca dialóige eile, féach an scáileán:

hipearnasc cóipeála doc chuig cill eile 03

5. Agus cóipeáladh na seoltaí hipearnasc ó na cealla bunaidh go dtí na cealla sonraithe de réir mar a theastaíonn uait, féach an scáileán:

hipearnasc cóipeála doc chuig cill eile 04

nótaí: Is féidir leis an gcód seo cabhrú leat na hipearnasc a chóipeáil ó bhileog amháin go bileog eile de réir mar is mian leat.

Uirlisí Táirgiúlachta Oifige is Fearr

🤖 Kutools AI Aide: anailís sonraí a réabhlóidiú bunaithe ar: Forghníomhú Chliste   |  Gin Cód  |  Cruthaigh Foirmlí Saincheaptha  |  Anailís a dhéanamh ar Sonraí agus Cairteacha a Ghin  |  Feidhmeanna Kutools a agairt...
Gnéithe Coitianta: Faigh, Aibhsigh nó Aithnigh Dúblaigh   |  Scrios Sraitheanna Bána   |  Comhcheangail Colúin nó Cealla gan Sonraí a Chailleadh   |   Babhta gan Foirmle ...
Cuardaigh Super: Ilchritéir VLookup    VLookup Illuachanna  |   VLookup Trasna Ilbhileoga   |   Amharc doiléir ....
Liosta anuas Casta: Go tapa Cruthaigh Liosta Anuas   |  Liosta anuas Cleithiúnach   |  Liosta Buail Isteach Ilroghnacha ....
Bainisteoir Colún: Cuir Líon Sonrach Colún leis  |  Colúin Bog  |  Scoránaigh Stádas Infheictheachta na gColún Ceilte  |  Déan comparáid idir Raonta & Colúin ...
Gnéithe Réadmhaoin: Fócas Eangaí   |  Amharc Dearaidh   |   Barra Mór na Foirmle    Leabhar Oibre & Bainisteoir Bileog   |  Leabharlann Acmhainní (Uaththéacs)   |  Piocálaí Dáta   |  Comhcheangail Bileoga Oibre   |  Criptigh/Díchriptigh Cealla    Seol Ríomhphost trí Liosta   |  Scagaire Super   |   Scagaire Speisialta (scagaire trom/iodálach/stailc tríd...) ...
Barr 15 Uirlisí12 Téacs uirlisí (Cuir Téacs, Bain Carachtair,...)   |   50 + Cairt cineálacha (Cairt Gantt,...)   |   40+ Praiticiúil Foirmlí (Ríomh aois bunaithe ar lá breithe,...)   |   19 Insertion uirlisí (Cuir isteach Cód QR, Ionsáigh Pictiúr ón gCosán,...)   |   12 Tiontú uirlisí (Uimhreacha le Focail, Comhshó Airgeadra,...)   |   7 Cumaisc & Scoilt uirlisí (Sraitheanna Comhcheangail Casta, Cealla Scoilt,...)   |   ... agus eile

Supercharge Do Scileanna Excel le Kutools le haghaidh Excel, agus Éifeachtúlacht Taithí Cosúil Ná Roimhe. Kutools le haghaidh Excel Tairiscintí Níos mó ná 300 Ardghnéithe chun Táirgiúlacht a Treisiú agus Sábháil Am.  Cliceáil anseo chun an ghné is mó a theastaíonn uait a fháil ...

Tuairisc


Tugann Tab Oifige comhéadan Tabbed chuig Office, agus Déan Do Obair i bhfad Níos Éasca

  • Cumasaigh eagarthóireacht agus léamh tabbed i Word, Excel, PowerPoint, Foilsitheoir, Rochtain, Visio agus Tionscadal.
  • Oscail agus cruthaigh cáipéisí iolracha i gcluaisíní nua den fhuinneog chéanna, seachas i bhfuinneoga nua.
  • Méadaíonn do tháirgiúlacht 50%, agus laghdaíonn sé na céadta cad a tharlaíonn nuair luch duit gach lá!

 

Comments (13)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
I made the following edits to work for my use case:
Sub CopyHyperlinks()
'Uodateby Extendoffice
Dim xSRg As Range
Dim xDRg As Range
Dim I As Integer
Dim xAddress As String
On Error Resume Next
xAddress = ActiveWindow.RangeSelection.Address
Set xSRg = Application.InputBox("Please select the original range you want to copy hyperlinks:", "KuTools For Excel", xAddress, , , , , 8)
If xSRg Is Nothing Then Exit Sub
Set xDRg = Application.InputBox("Please select the new range you want to paste the hyperlinks only", "KuTools For Excel", , , , , , 8)
If xDRg Is Nothing Then Exit Sub
Set xDRg = xDRg(1)
For I = 1 To xSRg.Count
If xSRg(I).Hyperlinks(1).Address <> "" Or xSRg(I).Hyperlinks(1).SubAddress <> "" Then
If xSRg(I).Hyperlinks.Count = 1 Then
xDRg(I).Hyperlinks.Add Anchor:=xDRg(I), _
Address:=xSRg(I).Hyperlinks(1).Address, _
SubAddress:=xSRg(I).Hyperlinks(1).SubAddress
'ScreenTip:=xSRg(I).Hyperlinks(1).ScreenTip, _
'TextToDisplay:=xSRg(I).Hyperlinks(1).TextToDisplay
End If
End If
Next
End Sub
This comment was minimized by the moderator on the site
OK, so you won't publish my comment - which is fair. But if you want me to register and log in, then you need to show me solutions that work, because (on the basis of one non-working instance) I've seen nothing to persuade me that there's any value in registering.
This comment was minimized by the moderator on the site
Doesn't work for me; does the fact that I'm still using Excel 2007 matter?
This comment was minimized by the moderator on the site
This is awesome and it works. I love copy&pasting other people's code :D
This comment was minimized by the moderator on the site
This didn't work for me either.
This comment was minimized by the moderator on the site
Lets say in your cell A1 is hyperlink, so to get the path of the hyperlink just create formula like below:
>> (MID((FORMULATEXT(A1));(FIND("(";(FORMULATEXT(A1)))+2);(FIND(";";(FORMULATEXT(A1)))-1)-(FIND("(";(FORMULATEXT(A1)))+2))) <<
This comment was minimized by the moderator on the site
Doesn't work.
This comment was minimized by the moderator on the site
Love it. Thank you so muchoooo.
Love From Dominican Republic :)
This comment was minimized by the moderator on the site
Doesn't work.
This comment was minimized by the moderator on the site
hello.. what if i want to copy the hyperlink through vlookup? i already have the formula but when i click the the hyperlink it "cannot open specied file" will appear.

Please help me
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations