View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
JFD JFD is offline
external usenet poster
 
Posts: 1
Default Copying multiple worksheets into a new workbook

You must declar
Dim IncludeSheet As Boolean (not string
.... now your test
if IncludeSheet = true then...
will wor

----- anhjan wrote: ----

Hey guys,

Im new to this VBA stuff and could use some help. I'm trying to cop
several worksheets into a new workbook. I'm using a loop to check
couple of Boolean fields to see if the sheet should be copied, if it'
true I would copy into a brand new workbook. However, I get stuck o
the second approach of the loop€

Here's my code...Any ideas what I'm doing wrong
Any Assistance would greatly be appreciated!

Sub Macro_test(

Dim wbk1 As Workboo
Dim wbk2 As Workboo
Dim IncludeSheet As Strin
Dim DataSheet As Strin
Dim Number As Intege

Set wbk1 = ActiveWorkboo
Set wbk2 = Workbooks.Ad

wbk1.Activat
Number =

For CounterComp = 6 To 1

IncludeSheet = wbk1.Worksheets("Landscap
Labels").Cells(CounterComp, 31
DataSheet = wbk1.Worksheets("Landscape Labels").Cells(CounterComp
7

If IncludeSheet = True The
Sheets(DataSheet).COPY After:=wbk2.Sheets(Number
Number = Number +

Els
Number = Number +

End I

Next CounterCom

End Su


--
Message posted from http://www.ExcelForum.com