다음을 통해 공유


WorksheetBase.Move 메서드

워크시트를 통합 문서의 다른 위치로 이동합니다.

네임스페이스:  Microsoft.Office.Tools.Excel
어셈블리:  Microsoft.Office.Tools.Excel.v4.0.Utilities(Microsoft.Office.Tools.Excel.v4.0.Utilities.dll)

구문

‘선언
Public Sub Move ( _
    before As Object, _
    after As Object _
)
public void Move(
    Object before,
    Object after
)

매개 변수

  • before
    형식: System.Object
    이동한 시트를 삽입할 위치의 뒤에 있는 시트입니다. After를 지정하는 경우 Before를 지정할 수 없습니다.
  • after
    형식: System.Object
    이동한 시트를 삽입할 위치의 앞에 있는 시트입니다. Before를 지정하는 경우 After를 지정할 수 없습니다.

설명

Before 또는 After 중 하나를 지정하지 않으면 Microsoft Office Excel에서는 이동한 시트를 포함하는 새 통합 문서를 만듭니다.

선택적 매개 변수

선택적 매개 변수에 대한 자세한 내용은 Office 솔루션의 선택적 매개 변수를 참조하십시오.

예제

다음 코드 예제에서는 Move 메서드를 사용하여 통합 문서의 마지막 위치로 워크시트를 이동하기 전후에 Index 속성을 사용하여 현재 워크시트의 인덱스 번호를 표시합니다.

이 예제는 문서 수준 사용자 지정을 위한 것입니다.

Private Sub DisplayIndex()
    MsgBox("Before moving, this worksheet is at tab number " & _
        Me.Index.ToString())

    ' Move the worksheet to the last position in the workbook.
    Me.Move(After:=Globals.ThisWorkbook.Worksheets( _
        Globals.ThisWorkbook.Worksheets.Count))

    MsgBox("After moving, this worksheet is at tab number " & _
        Me.Index.ToString())
End Sub
private void DisplayIndex()
{
    MessageBox.Show("Before moving, this worksheet is at tab number " +
        this.Index.ToString());

    // Move the worksheet to the last position in the workbook.
    this.Move(missing, 
        Globals.ThisWorkbook.Worksheets[Globals.ThisWorkbook.Worksheets.Count]);

    MessageBox.Show("After moving, this worksheet is at tab number " +
        this.Index.ToString());
}

.NET Framework 보안

  • 직접 실행 호출자의 경우 완전히 신뢰합니다. 이 멤버는 부분적으로 신뢰할 수 있는 코드에서 사용할 수 없습니다. 자세한 내용은 부분 신뢰 코드에서 라이브러리 사용을 참조하십시오.

참고 항목

참조

WorksheetBase 클래스

Microsoft.Office.Tools.Excel 네임스페이스