VBA/Excel/Access/Word/Excel/Worksheet Move — различия между версиями

Материал из VB Эксперт
Перейти к: навигация, поиск
м (1 версия)
 
(нет различий)

Версия 16:33, 26 мая 2010

copy the third worksheet before the 2nd worksheet

 
Sub SimpleWorksheetMovement() 
    " copy the third worksheet before the 2nd worksheet 
    ThisWorkbook.Worksheets(3).Copy ThisWorkbook.Worksheets(2) 
End Sub



copy the third worksheet to a new book

 
Sub SimpleWorksheetMovement() 
    ThisWorkbook.Worksheets(3).Copy 
End Sub



Drag the third worksheet to the first sheet position

 
Sub Macro3()
    Sheets("Sheet3").Select
    Sheets("Sheet3").Move Before:=Sheets(1)
End Sub



Move sheet to the end

 
Sub Move_Sheet()
    Dim myWorksheet As Worksheet
    Dim myWorksheetName As String
        myWorksheetName = "MyName"
        Sheets.Add.Name = myWorksheetName
        Sheets(myWorksheetName).Move After:=Sheets(Sheets.Count)
        Sheets("Sheet1").Range("A1:A5").Copy _
            Sheets(myWorksheetName).Range("A1")
End Sub