ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Creating a new worksheet? (https://www.excelbanter.com/excel-programming/338788-creating-new-worksheet.html)

schoujar[_6_]

Creating a new worksheet?
 

Hi,

Just wondering how I could create a new worksheet from within a macro?

Cheers

Sahil

EDIT: I'd also like to know how to create new workbooks from a macro
and how to name the individual workbooks/worksheets

--
schouja
-----------------------------------------------------------------------
schoujar's Profile: http://www.excelforum.com/member.php...fo&userid=2657
View this thread: http://www.excelforum.com/showthread.php?threadid=40068


mangesh_yadav[_378_]

Creating a new worksheet?
 

Sheet

ActiveWorkbook.Sheets.Add Befo=Worksheets(Worksheets.Count)


Workbook

Workbooks.Add


Check VBA help, type ADD, and press F1



Manges

--
mangesh_yada
-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=40068


Patrick Molloy[_2_]

Creating a new worksheet?
 
use a worksheet object for greater control...

DIM ws as Worksheet
SET ws = worksheets.add
with ws
.Name = "myNewSheet"

.Range("A1") = format$(Date,"dd-mmm-yy HH:MM")

end with





"schoujar" wrote:


Hi,

Just wondering how I could create a new worksheet from within a macro?

Cheers

Sahil

EDIT: I'd also like to know how to create new workbooks from a macro.
and how to name the individual workbooks/worksheets?


--
schoujar
------------------------------------------------------------------------
schoujar's Profile: http://www.excelforum.com/member.php...o&userid=26574
View this thread: http://www.excelforum.com/showthread...hreadid=400685




All times are GMT +1. The time now is 02:04 AM.

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