메인 컨텐츠로 가기

행을 여러 번 복사하고 삽입하거나 Excel에서 행을 x 번 복제하는 방법은 무엇입니까?

일상 업무에서 한 행 또는 각 행을 복사 한 다음 워크 시트의 현재 데이터 행 아래에 여러 번 삽입 해 본 적이 있습니까? 예를 들어, 셀 범위가 있습니다. 이제 다음 스크린 샷과 같이 각 행을 복사하여 다음 행에 3 번 붙여넣고 싶습니다. Excel에서이 작업을 어떻게 처리 할 수 ​​있습니까?


VBA 코드로 특정 행을 여러 번 복사 및 삽입

특정 행 하나만 x 번 복제하려면 다음 VBA 코드가 도움이 될 수 있습니다. 다음과 같이하십시오.

1. 여러 번 복사 및 삽입 할 행을 지정한 다음 ALT + F11 키를 누른 다음 응용 프로그램 용 Microsoft Visual Basic 창.

2. 딸깍 하는 소리 끼워 넣다 > 모듈을 클릭하고 다음 코드를 모듈 창문.

VBA 코드 : 특정 행 하나를 여러 번 복제합니다.

Sub test()
'Updateby Extendoffice
    Dim xCount As Integer
LableNumber:
    xCount = Application.InputBox("Number of Rows", "Kutools for Excel", , , , , , 1)
    If xCount < 1 Then
        MsgBox "the entered number of rows is error, please enter again", vbInformation, "Kutools for Excel"
        GoTo LableNumber
    End If
    ActiveCell.EntireRow.Copy
    Range(ActiveCell.Offset(1, 0), ActiveCell.Offset(xCount, 0)).EntireRow.Insert Shift:=xlDown
    Application.CutCopyMode = False
End Sub

3. 코드를 붙여 넣은 후 F5 키를 눌러이 코드를 실행하면 복제 할 횟수를 입력하라는 메시지 상자가 나타납니다. 스크린 샷을 참조하십시오.

4. 그런 다음 OK 버튼을 클릭하고 세 개의 새로운 복사 된 행이 선택한 행 아래에 삽입되었습니다. 스크린 샷 참조 :


특정 번호를 기준으로 각 행을 여러 번 쉽게 복사 및 삽입

일반적으로 수동 복사 및 삽입 처리를 제외하고 행을 여러 번 복사 및 삽입하는 좋은 방법은 없습니다. 하지만 함께 Excel 용 Kutools's 셀 값을 기반으로 행 / 열 복제 이 문제를 쉽게 해결할 수 있습니다. Excel 용 Kutools를 다운로드하려면 클릭하십시오!

Excel 용 Kutools: 300 개 이상의 편리한 Excel 추가 기능으로 60 일 동안 제한없이 무료로 사용해 볼 수 있습니다. 지금 다운로드 및 무료 평가판!


VBA 코드로 각 행을 여러 번 복사 및 삽입

범위에서 각 행을 여러 번 복제하려면 다음 VBA 코드를 적용 할 수 있습니다. 다음과 같이하십시오.

1. 누르고 ALT + F11 키를 누른 다음 응용 프로그램 용 Microsoft Visual Basic 창.

2. 딸깍 하는 소리 끼워 넣다 > 모듈을 클릭하고 다음 코드를 모듈 창문.

VBA 코드 : 각 행을 여러 번 복제합니다.

Sub insertrows()
'Updateby Extendoffice
Dim I As Long
Dim xCount As Integer
LableNumber:
xCount = Application.InputBox("Number of Rows", "Kutools for Excel", , , , , , 1)
If xCount < 1 Then
MsgBox "the entered number of rows is error ,please enter again", vbInformation, "Kutools for Excel"
GoTo LableNumber
End If
For I = Range("A" & Rows.CountLarge).End(xlUp).Row To 2 Step -1
Rows(I).Copy
Rows(I).Resize(xCount).Insert
Next
Application.CutCopyMode = False
End Sub

3. 그런 다음 F5 키를 눌러이 코드를 실행하면 각 레코드에 대해 복제 할 횟수를 입력하라는 메시지 상자가 나타납니다. 스크린 샷을 참조하십시오.

4. 그런 다음 OK, 각 행이 복사되어 활성 행 아래에 3 번 삽입되었습니다 (스크린 샷 참조).

주의 사항: 위 코드에서 A 데이터가 열에서 시작하는 경우 데이터 범위가 열 A에서 시작됨을 나타냅니다. K, 바꿔주세요 AK 당신의 필요로.


멋진 기능으로 특정 번호를 기준으로 각 행을 여러 번 복사하고 삽입하십시오.

아마도 VBA 코드에 익숙하지 않거나 코드로 인해 데이터가 충돌 할까 걱정할 수 있습니다. 여기에서는 유용한 기능을 소개하겠습니다. Excel 용 Kutools's 셀 값을 기반으로 행 / 열 복제,이 유틸리티를 사용하면 지정한 번호에 따라 행을 빠르게 복사하고 삽입 할 수 있습니다.

팁 :이것을 적용하려면 셀 값을 기반으로 행 / 열 복제 먼저 기능을 다운로드해야합니다. Excel 용 Kutools을 클릭 한 다음 기능을 빠르고 쉽게 적용하십시오.

설치 후 Excel 용 Kutools, 다음과 같이하십시오.

1. 데이터 옆의 셀 목록에서 행을 복제하려는 반복 번호를 입력하십시오. 스크린 샷을 참조하십시오.

2. 딸깍 하는 소리 쿠툴 > 끼워 넣다 > 셀 값을 기반으로 행 / 열 복제, 스크린 샷 참조 :

3. 에서 행과 열 복사 및 삽입 대화 상자에서 행 복사 및 삽입 에서 옵션 타입 섹션에서 복제하려는 데이터 범위를 선택한 다음 행을 복제 할 반복 시간을 지정합니다. 스크린 샷을 참조하십시오.

4. 그런 다음 Ok or 신청 버튼을 클릭하면 필요에 따라 다음과 같은 결과가 표시됩니다.

Excel 용 Kutools 및 무료 평가판을 지금 다운로드하려면 클릭하십시오!

최고의 사무 생산성 도구

🤖 Kutools AI 보좌관: 다음을 기반으로 데이터 분석을 혁신합니다. 지능형 실행   |  코드 생성  |  사용자 정의 수식 만들기  |  데이터 분석 및 차트 생성  |  Kutools 기능 호출...
인기 기능: 중복 항목 찾기, 강조 표시 또는 식별   |  빈 행 삭제   |  데이터 손실 없이 열이나 셀 결합   |   수식없이 반올림 ...
슈퍼 조회: 다중 기준 VLookup    다중 값 VLookup  |   여러 시트에 걸친 VLookup   |   퍼지 조회 ....
고급 드롭다운 목록: 드롭다운 목록을 빠르게 생성   |  종속 드롭다운 목록   |  다중 선택 드롭 다운 목록 ....
열 관리자: 특정 개수의 열 추가  |  열 이동  |  Toggle 숨겨진 열의 가시성 상태  |  범위 및 열 비교 ...
특색 지어진 특징: 그리드 포커스   |  디자인보기   |   큰 수식 바    통합 문서 및 시트 관리자   |  리소스 라이브러리 (자동 텍스트)   |  날짜 선택기   |  워크 시트 결합   |  셀 암호화/해독    목록으로 이메일 보내기   |  슈퍼 필터   |   특수 필터 (굵게/기울임꼴/취소선 필터링...) ...
상위 15개 도구 세트12 본문 도구 (텍스트 추가, 문자 제거,...)   |   50+ 거래차트 유형 (Gantt 차트,...)   |   40+ 실용 방식 (생일을 기준으로 나이 계산,...)   |   19 삽입 도구 (QR 코드 삽입, 경로에서 그림 삽입,...)   |   12 매출 상승 도구 (숫자를 단어로, 환율,...)   |   7 병합 및 분할 도구 (고급 결합 행, 셀 분할,...)   |   ... 그리고 더

Excel용 Kutools로 Excel 기술을 강화하고 이전과는 전혀 다른 효율성을 경험해 보세요. Excel용 Kutools는 생산성을 높이고 시간을 절약하기 위해 300개 이상의 고급 기능을 제공합니다.  가장 필요한 기능을 얻으려면 여기를 클릭하십시오...

상품 설명


Office Tab은 Office에 탭 인터페이스를 제공하여 작업을 훨씬 쉽게 만듭니다.

  • Word, Excel, PowerPoint에서 탭 편집 및 읽기 사용, Publisher, Access, Visio 및 Project.
  • 새 창이 아닌 동일한 창의 새 탭에서 여러 문서를 열고 만듭니다.
  • 생산성을 50% 높이고 매일 수백 번의 마우스 클릭을 줄입니다!
Comments (32)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Halo

Ik heb een zoek programma gemaakt met VBA die de cel van het gezocht item groen maakt
Bijv. saldo 1 euro komt 3x voor in een blad ( B2 t/m F16 )
Dan maakt hij 3x de cel Saldo 1 euro groen
Nou zou ik graag willen dat hij deze 3 items kopieert op hetzelfde blad in kolom H
Wie weet hoe je dit moet schrijven in een Macro

B.v.d. Michel
This comment was minimized by the moderator on the site
Bonjour,
J'ai pu tester ce code (celui en haut du post) pour dupliquer plusieurs lignes autant de fois que le nombre présent dans la dernière colonne. Cela fonctionne très bien, Merci.
Par contre, dans une des colonnes, il y a une date de début. Je voudrais que cette date s'incrémente automatiquement lors de la duplication.
Pouvez vous m'aider s'il vous plait, je ne trouve pas la réponse sur internet ?
Merci par avance.
This comment was minimized by the moderator on the site
It took more time to make google understand what I want, But after I found this page, it takes a few minutes to get what I was searching for. Many thanks 👍
This comment was minimized by the moderator on the site
I desire to have the VBA Code for Copy And Insert Each Row Multiple Times Based On A Specific Number , please assist, Thank you
This comment was minimized by the moderator on the site
Hi, Carl,To copy and insert the rows multiple times based on specific numbers, please apply the below code:<div data-tag="code">Sub CopyRow()
'UpdatebyExtendoffice
Dim xRg As Range
Dim xCRg As Range
Dim xFNum As Integer
Dim xRN As Integer
On Error Resume Next
SelectRange:
xTxt = ActiveWindow.RangeSelection.Address
Set xRg = Application.InputBox("Select the list of numbers to copy the rows based on: ", "Kutools for Excel", xTxt, , , , , 8)
If xRg Is Nothing Then Exit Sub

If xRg.Columns.Count > 1 Then
MsgBox "Please select single column!"
GoTo SelectRange
End If
Application.ScreenUpdating = False
For xFNum = xRg.Count To 1 Step -1
Set xCRg = xRg.Item(xFNum)
xRN = CInt(xCRg.Value)
With Rows(xCRg.Row)
.Copy
.Resize(xRN).Insert
End With
Next
Application.ScreenUpdating = True
End SubPlease try, hope it can help you!
This comment was minimized by the moderator on the site
skyyang not work!
This comment was minimized by the moderator on the site
This code works great. I have a situation where I am using Excel as a quote form. Worksheet one is the actual bid, and worksheet two is our cost page. When I insert the copied rows, I need it to do so on both pages. I have tried adding some code to select both pages, but it does not seem to work. Any help is greatly appreciated.
This comment was minimized by the moderator on the site
For the second VBA code (VBA code: Duplicate each row multiple times) I keep getting as run time error: 1004
This comment was minimized by the moderator on the site
Hello, is it possible to use different sizes(values) for each row? I am trying using vector, but it is not working.
For instance :
Rows(I).Resize(xCount(y) ).Insert

Where the values saved in xCount(y) are read from a table.
This comment was minimized by the moderator on the site
Hello, Guss,
May be the below article can help you, please check it:
https://www.extendoffice.com/documents/excel/4054-excel-duplicate-rows-based-on-cell-value.html
This comment was minimized by the moderator on the site
hi everyone.. Thank you in advance for you help!!

The VBA code to duplicate one specific row multiple times work perfectly until you use a filter. I wonder if someone can help me to solve this issue. I need a code that work even if you have some values filtered. I am using a large amount of data that is sort by locations. The code partially work, it pastes the number of row desire but no data or format when I have applied a filter.
This comment was minimized by the moderator on the site
No funciona con Windows 2019, deseo usar la función en mención pero simplemente no hace absolutamente nada
This comment was minimized by the moderator on the site
Copy And Insert Each Row Multiple Times With VBA Code

In VBA code how can I select the starting row
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