Cuidiú fianáin linn ár seirbhísí a sheachadadh. Trí úsáid a bhaint ár gcuid seirbhísí, aontaíonn tú úsáid a bhainimid as fianáin.
Leid: Aistrítear Google-theangacha eile. Is féidir leat cuairt a thabhairt ar an English leagan den nasc seo.
Logáil isteach
x
or
x
x
Cláraigh
x

or

Conas sraitheanna a dhúbailt atá bunaithe ar luach cille i gcolún?

Mar shampla, tá réimse sonraí agam ina bhfuil liosta uimhreacha i gcolún D, agus anois, ba mhaith liom na sraitheanna iomlána a dhúbailt roinnt uaireanta atá bunaithe ar na luachanna uimhriúla i gcolún D chun an toradh seo a leanas a fháil. Cén chaoi ar féidir liom na sraitheanna a chóipeáil il-uaire bunaithe ar na luachanna cille in Excel?

doc sraitheanna dhúbailt de réir ceall 1

Sraitheanna dúbailte iolracha bunaithe ar luachanna cille le cód VBA


mboilgeog ceart gorm arrow Sraitheanna dúbailte iolracha bunaithe ar luachanna cille le cód VBA

Chun na sraitheanna iomlána a chóipeáil agus a dhúbailt iolrach bunaithe ar na luachanna cille, féadfaidh an cód VBA seo a leanas cabhrú leat, déan mar seo:

1. Coinnigh síos an ALT + F11 eochracha a oscailt Microsoft Visual Basic d'Iarratais fhuinneog.

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

Cód VBA: Sraitheanna dúbailte iolracha bunaithe ar luach cille:

Sub CopyData()
'Updateby Extendoffice 20160922
    Dim xRow As Long
    Dim VInSertNum As Variant
    xRow = 1
    Application.ScreenUpdating = False
    Do While (Cells(xRow, "A") <> "")
        VInSertNum = Cells(xRow, "D")
        If ((VInSertNum > 1) And IsNumeric(VInSertNum)) Then
           Range(Cells(xRow, "A"), Cells(xRow, "D")).Copy
           Range(Cells(xRow + 1, "A"), Cells(xRow + VInSertNum - 1, "D")).Select
           Selection.Insert Shift:=xlDown
           xRow = xRow + VInSertNum - 1
        End If
        xRow = xRow + 1
    Loop
    Application.ScreenUpdating = False
End Sub

3. Ansin brúigh F5 Is eochair an cód seo a reáchtáil, rinneadh na sraitheanna iomlána a dhúbailt iolraithe ar bhonn an luach cille i gcolún D de réir mar is gá duit.

nótaí: Sa chód thuas, an litir A Léiríonn colún tosaigh do raon sonraí, agus an litir D Is é an litir colún gur mian leat na sraitheanna a dhúbailt atá bunaithe ar. Athraigh iad le do riachtanas.



Uirlisí Táirgiúlachta Molta

Tab Office

óir star1 Tabs tabs láimhe le Excel agus bogearraí eile Oifige, cosúil le Chrome, Firefox agus Internet Explorer nua.

Kutools le haghaidh Excel

óir star1 Iontach! Méadú do tháirgiúlacht i 5 nóiméad. Ní gá aon scileanna speisialta a bheith agat, ach dhá uair an chloig a shábháil gach lá!

óir star1 Gnéithe Nua 300 le haghaidh Excel, Déan Excel Mór Éasca agus Cumhachtach:

  • Cumaisc Cill / Sraitheanna / Colúin gan Sonraí a Chailliúint.
  • Ilchláir agus Leabhair Oibre a Chomhcheangal agus a Chomhdhlúthú.
  • Déan comparáid idir Ranganna, Cóipeáil Ilchéimeanna, Tiontaigh Téacs go dtí Dáta, Aonad agus Comhshó Airgeadra.
  • Count by Colors, Subtotals Paging, Ard-Shórtáil agus Scagaire Super,
  • Tuilleadh Roghnaigh / Ionsáigh / Scrios / Téacs / Formáid / Nasc / Comment / Leabhair Oibre / Bileoga Oibre Uirlisí ...

Lámhach scáileán de Kutools do Excel

Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    KAS · 1 months ago
    Is there a way to update the module to only duplicate new data? I'm working on an ongoing document and do not want the code to duplicate data that has been previously duplicated.
  • To post as a guest, your comment is unpublished.
    Gerardo Enrique Heras Araujo · 2 months ago
    hi, for me is no working, I want to remove letters and number duplicate is possible?
  • To post as a guest, your comment is unpublished.
    Naomi · 2 months ago
    This script seems to be exactly what I need, however, when I run it I am getting an error on the line Selection.Insert Shift:=x1Down

    Any suggestions on how I fix this?
  • To post as a guest, your comment is unpublished.
    Manuel F · 2 months ago
    Thanks! it has been a great solution for all my troubles!
  • To post as a guest, your comment is unpublished.
    Leah · 3 months ago
    Hello, this worked great. However, I have a report with 1000 entries and the code stopped duplicating around entry 480. Is there something that I can add so that it completes the action on the entire report?
    • To post as a guest, your comment is unpublished.
      skyyang · 3 months ago
      Hello, Leah,
      I have tested the code in 2000 rows, and it works well.
      Could you send your worksheet to me for testing the code?
      My email address is skyyang@extendoffice.com
      Look forward to your reply!
      • To post as a guest, your comment is unpublished.
        Leah · 3 months ago
        Hello! I got it to work. It was an error on my side, the report had a few blank rows that were hidden that were causing the script to stop looping. It worked for my report with 8,000 rows! Thank youQ