Select Multiple Active Sheets (not by name)

  • Hi,


    I am trying to create a clean generic macro to copy selected sheets to a new workbook and then paste those sheets as values.


    I have done this for the active sheet, but cannot seem to find the terminology to copy all of the selected worksheets (grouped) without using the worksheet names (making it workbook specific).


    Any suggestions very gratefully received



    Thanks in advance,


    Mike

  • Try the following. It assumes the sheets have been selected and you want them to be copied to a new workbook.
    [vba]
    Sub TryThis()
    Dim w As Worksheet
    ActiveWindow.SelectedSheets.Copy
    For Each w In ActiveWorkbook.Sheets
    With w.UsedRange
    .Value = .Value
    End With
    Next w
    End Sub
    [/vba]

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!