Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub aacopysheets()
Dim varr As Variant Dim i As Long Dim sh As Worksheet ReDim varr(0 To ThisWorkbook.Worksheets.Count - 1) i = 0 For Each sh In ThisWorkbook.Worksheets If InStr(1, sh.Range("A1").Value, "report", vbTextCompare) Then varr(i) = sh.Name i = i + 1 End If Next ReDim Preserve varr(0 To i - 1) Worksheets(varr).Copy End Sub In the above example, any sheet that has the word report contained in the value of cell A1 is copied. -- Regards, Tom Ogilvy "John Turton" wrote in message ... What sort of criteria could I use ? At the moment I am copying a specific set of worksheets containing the assumptions and results of a model. I don't want to copy the sheets containing the model itself since the whole model is 13Mb. I want to have a set of sheets containing the assumptions that just get copied out of the original workbook and a second set of sheets that get copied out of the workbook and then copied and pasted as values. None of this is difficult if all the sheets keep their names and none are added, but the model is still being developed and I am likely to create new sheets which I want to add to a list rather than editing a long list in vba. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
copying data to different worksheets in the same workbook | Excel Worksheet Functions | |||
copying worksheets in a workbook limit? | Excel Worksheet Functions | |||
copying multiple worksheets to a new workbook | Excel Discussion (Misc queries) | |||
Copying worksheets to a new workbook | Excel Discussion (Misc queries) | |||
copying addresses from one workbook to another into several worksheets | Excel Worksheet Functions |