메인 컨텐츠로 가기

Excel에서 선택한 범위의 테두리 만 복사하는 방법은 무엇입니까?

Microsoft Excel을 사용하는 동안 선택하여 붙여 넣기 기능을 사용하면 범위에서 셀 값, 셀 서식, 셀 수식 등 만 쉽게 복사 할 수 있습니다. 그러나 Excel의 범위에서 테두리 스타일 만 복사 해 본 적이 있습니까? 이 기사에서는 선택한 범위의 테두리 만 Excel의 새 범위로 복사하는 방법을 보여줍니다.

VBA 코드로 선택한 범위의 테두리 만 복사


VBA 코드로 선택한 범위의 테두리 만 복사

다음 VBA 코드는 선택한 셀의 테두리 스타일 만 복사 한 다음이 테두리 스타일을 Excel의 새 범위에 적용하는 데 도움이 될 수 있습니다. 다음과 같이하십시오.

1. 누르세요 다른 + F11 키를 눌러 응용 프로그램 용 Microsoft Visual Basic 창.

2. 에서 응용 프로그램 용 Microsoft Visual Basic 창을 클릭합니다 끼워 넣다 > 모듈을 클릭 한 다음 아래 VBA 코드를 복사하여 코드 창에 붙여 넣습니다.

VBA 코드 : Excel에서 선택한 범위의 테두리 만 복사

Sub CopyBorders()
'Updated by Extendoffice 20211203
    Dim xRg, yRg As Range
    On Error Resume Next
    
    Set xRg = Application.InputBox("Select Range with Borders to Copy...", "Kutools For Excel", , , , , , 8)
    Set yRg = Application.InputBox("Select Cell to Apply Borders to range..", "Kutools For Excel", , , , , , 8)
    
    
    With yRg.Borders(xlEdgeLeft)
        .LineStyle = xRg.Borders(xlEdgeLeft).LineStyle
        .ColorIndex = xRg.Borders(xlEdgeLeft).ColorIndex
        .TintAndShade = xRg.Borders(xlEdgeLeft).TintAndShade
        .Weight = xRg.Borders(xlEdgeLeft).Weight

    End With
    With yRg.Borders(xlEdgeTop)
        .LineStyle = xRg.Borders(xlEdgeTop).LineStyle
        .ColorIndex = xRg.Borders(xlEdgeTop).ColorIndex
        .TintAndShade = xRg.Borders(xlEdgeTop).TintAndShade
        .Weight = xRg.Borders(xlEdgeTop).Weight
    End With
    With yRg.Borders(xlEdgeBottom)
        .LineStyle = xRg.Borders(xlEdgeBottom).LineStyle
        .ColorIndex = xRg.Borders(xlEdgeBottom).ColorIndex
        .TintAndShade = xRg.Borders(xlEdgeBottom).TintAndShade
        .Weight = xRg.Borders(xlEdgeBottom).Weight
    End With
    With yRg.Borders(xlEdgeRight)
        .LineStyle = xRg.Borders(xlEdgeRight).LineStyle
        .ColorIndex = xRg.Borders(xlEdgeRight).ColorIndex
        .TintAndShade = xRg.Borders(xlEdgeRight).TintAndShade
        .Weight = xRg.Borders(xlEdgeRight).Weight
    End With

    With yRg.Borders(xlInsideHorizontal)
        .LineStyle = xRg.Borders(xlInsideHorizontal).LineStyle
        .ColorIndex = xRg.Borders(xlInsideHorizontal).ColorIndex
        .TintAndShade = xRg.Borders(xlInsideHorizontal).TintAndShade
        .Weight = xRg.Borders(xlInsideHorizontal).Weight
    End With
    With yRg.Borders(xlInsideVertical)
        .LineStyle = xRg.Borders(xlInsideVertical).LineStyle
        .ColorIndex = xRg.Borders(xlInsideVertical).ColorIndex
        .TintAndShade = xRg.Borders(xlInsideVertical).TintAndShade
        .Weight = xRg.Borders(xlInsideVertical).Weight
    End With
End Sub

3. 누르세요 F5 코드를 실행하는 키입니다. 첫 번째 팝업에서 Excel 용 Kutools 대화 상자에서 복사 할 테두리가있는 범위를 선택한 다음 OK 버튼을 클릭합니다.

4. 두 번째 Excel 용 Kutools 대화 상자에서 복사 한 테두리를 적용 할 셀을 선택한 다음 OK 단추. 스크린 샷보기 :

그러면 아래 스크린 샷과 같이 선택한 범위의 테두리 스타일 만 복사되어 새 범위에 적용되는 것을 볼 수 있습니다.


관련 기사:

최고의 사무 생산성 도구

🤖 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 (6)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Hola me gusto mucho al macro para copiar los Bordes, pero al copiar los bordes me borra el formato que tienen las celtas es decir borra colores y otros formatos que ya tiene la celda. me puedes ayudar con una macro que me permita copiar los bordes de otra celta a otra sin borrar el formato que tiene la celda de destino?
This comment was minimized by the moderator on the site
Dobrý den,

Děkuji za pomoc s kopírováním pouze ohraničení.
Šlo by
Děkuji.
Jirka
This comment was minimized by the moderator on the site
The code also copied my numeric formats and overwrote those in the target cells. Perhaps I did something wrong?
This comment was minimized by the moderator on the site
Hi David,
In my case, the code only copy the borders into the target cells. Can you tell me your Excel version? Thank you for your comment.
This comment was minimized by the moderator on the site
Hello crystal,
I know this is over a year later, but due to a rehosting of my e-mail system, your question rose to the top of my inbox.
My Excel version is 2016 16.0.4993.1001 as reported by Account>About
This comment was minimized by the moderator on the site
Hi David,
Glad to receive your reply. I have tested the code in my Excel 2016, but it still copy the border only. Do you mind sending a copy of your data to ? Sorry for the inconvenience.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations