ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Code to create atbs in excel sheet (https://www.excelbanter.com/excel-discussion-misc-queries/90691-code-create-atbs-excel-sheet.html)

deepa prabhakar

Code to create atbs in excel sheet
 

My doubt is this.
I need to write a program to open an excel sheet and copy 3 excel sheet
into single .xls file which should contain 3 excel sheets.How do i
proceed?


--
deepa prabhakar
------------------------------------------------------------------------
deepa prabhakar's Profile: http://www.excelforum.com/member.php...o&userid=34821
View this thread: http://www.excelforum.com/showthread...hreadid=545774


mrice

Code to create atbs in excel sheet
 

To create your new workbook with three sheets you can use

Sub Test()
Workbooks.Add
If ActiveWorkbook.Sheets.Count < 3 Then
For N = 1 To 3 - ActiveWorkbook.Sheets.Count
Sheets.Add
Next N
ElseIf ActiveWorkbook.Sheets.Count 3 Then
Application.DisplayAlerts = False
For N = 1 To ActiveWorkbook.Sheets.Count - 3
Sheets(1).Delete
Next N
Application.DisplayAlerts = True
End If
End Sub


--
mrice

Research Scientist with many years of spreadsheet development experience
------------------------------------------------------------------------
mrice's Profile: http://www.excelforum.com/member.php...o&userid=10931
View this thread: http://www.excelforum.com/showthread...hreadid=545774



All times are GMT +1. The time now is 07:00 PM.

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