ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Add New Worksheet in new workbook (https://www.excelbanter.com/excel-discussion-misc-queries/214416-add-new-worksheet-new-workbook.html)

jlclyde

Add New Worksheet in new workbook
 
I am trying to have VBA add a workbook, name sheet 1 as Quote Proposal
and remove any other sheets. Or not add them, which ever is easier.
My code keeps throwing an error,

Set CopyBook = Workbooks.Add
CopyBook.Sheet1.Name "Quote Proposal"
Quote1.Sheets("quote").Range("A1:J52").Copy _
Destination:=CopyBook.Sheet1.Range("A1")

Thanks,
Jay

joel

Add New Worksheet in new workbook
 
Set CopyBook = Workbooks.Add
CopyBook.sheets("Sheet1").Name = "Quote Proposal"
Quote1.Sheets("quote").Range("A1:J52").Copy _
Destination:=CopyBook.Sheets("Quote Proposal").Range("A1")



"jlclyde" wrote:

I am trying to have VBA add a workbook, name sheet 1 as Quote Proposal
and remove any other sheets. Or not add them, which ever is easier.
My code keeps throwing an error,

Set CopyBook = Workbooks.Add
CopyBook.Sheet1.Name "Quote Proposal"
Quote1.Sheets("quote").Range("A1:J52").Copy _
Destination:=CopyBook.Sheet1.Range("A1")

Thanks,
Jay


Gary''s Student

Add New Worksheet in new workbook
 
Sub hfakdf()
Set CopyBook = Workbooks.Add
CopyBook.Sheets(1).Name = "Quote Proposal"
End Sub

--
Gary''s Student - gsnu200822


"jlclyde" wrote:

I am trying to have VBA add a workbook, name sheet 1 as Quote Proposal
and remove any other sheets. Or not add them, which ever is easier.
My code keeps throwing an error,

Set CopyBook = Workbooks.Add
CopyBook.Sheet1.Name "Quote Proposal"
Quote1.Sheets("quote").Range("A1:J52").Copy _
Destination:=CopyBook.Sheet1.Range("A1")

Thanks,
Jay


Dave Peterson

Add New Worksheet in new workbook
 
One mo

Dim CopyWks as worksheet
set copywks = workbooks.add(1).worksheets(1)
with copywks
.name = "Quote Proposal"
quote1.sheets("quote").range("a1:J52").copy _
destination:=.range("a1")
end with

workbooks.add(1)
will add a workbook with a single sheet.

jlclyde wrote:

I am trying to have VBA add a workbook, name sheet 1 as Quote Proposal
and remove any other sheets. Or not add them, which ever is easier.
My code keeps throwing an error,

Set CopyBook = Workbooks.Add
CopyBook.Sheet1.Name "Quote Proposal"
Quote1.Sheets("quote").Range("A1:J52").Copy _
Destination:=CopyBook.Sheet1.Range("A1")

Thanks,
Jay


--

Dave Peterson

jlclyde

Add New Worksheet in new workbook
 
On Dec 22, 9:54*am, Dave Peterson wrote:
One mo

Dim CopyWks as worksheet
set copywks = workbooks.add(1).worksheets(1)
with copywks
* *.name = "Quote Proposal"
* *quote1.sheets("quote").range("a1:J52").copy _
* * * destination:=.range("a1")
end with

workbooks.add(1)
will add a workbook with a single sheet.

jlclyde wrote:

I am trying to have VBA add a workbook, name sheet 1 as Quote Proposal
and remove any other sheets. *Or not add them, which ever is easier.
My code keeps throwing an error,


* * Set CopyBook = Workbooks.Add
* * CopyBook.Sheet1.Name "Quote Proposal"
* * Quote1.Sheets("quote").Range("A1:J52").Copy _
* * * * Destination:=CopyBook.Sheet1.Range("A1")


Thanks,
Jay


--

Dave Peterson


I want to thank you all for the great advice. i will definitly try to
use these in the future. I really like this last one by Dave.
Thanks,
Jay


All times are GMT +1. The time now is 11:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com