Sub abCopyToOtherSheet() '### 다른 시트로 영역 복사해 넣기. '### Created by abyul.com
Dim shtSource As Worksheet Set shtSource = Sheets("입력창") Dim rngSource As Range Set rngSource = shtSource.Range("A7:D7") '### 복사할 데이터가 1줄 이상이고 또는 가변적일 경우.. ' Set rngSource = shtSource.Range("A6") ' Set rngSource = shtSource.Range(rngSource.Offset.End(xlToRight), rngSource.Offset.End(xlDown)) ' Set rngSource = rngSource.Resize(rngSource.Rows.Count - 1).Offset(1)
Dim shtTarget As Worksheet '### 미리 워크시트에서 A1셀을 nmShtOut이라고 영역이름 정의함 Set shtTarget = Sheets([nmShtOut].Value) Dim rngLastCell As Range Set rngLastCell = shtTarget.Range("A" & shtTarget.Cells.SpecialCells(xlLastCell).Row) Set rngLastCell = rngLastCell.Offset(1).End(xlUp)
안녕하세요? 광택님.. ㅎㅎ
아래 코드를 이용해보세요..
첨부파일을 참고하시구요.. ^^
다운받기 : abyul.com_20111115_kwangTak-1.xls
Sub abCopyToOtherSheet()
'### 다른 시트로 영역 복사해 넣기.
'### Created by abyul.com
Dim shtSource As Worksheet
Set shtSource = Sheets("입력창")
Dim rngSource As Range
Set rngSource = shtSource.Range("A7:D7")
'### 복사할 데이터가 1줄 이상이고 또는 가변적일 경우..
' Set rngSource = shtSource.Range("A6")
' Set rngSource = shtSource.Range(rngSource.Offset.End(xlToRight), rngSource.Offset.End(xlDown))
' Set rngSource = rngSource.Resize(rngSource.Rows.Count - 1).Offset(1)
Dim shtTarget As Worksheet
'### 미리 워크시트에서 A1셀을 nmShtOut이라고 영역이름 정의함
Set shtTarget = Sheets([nmShtOut].Value)
Dim rngLastCell As Range
Set rngLastCell = shtTarget.Range("A" & shtTarget.Cells.SpecialCells(xlLastCell).Row)
Set rngLastCell = rngLastCell.Offset(1).End(xlUp)
rngSource.Copy rngLastCell.Offset(1)
End Sub