Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default How do i create a new worksheet

hello

how do i create a new worksheet in a workbook using code?

can i also rename the worksheet and put it in alphibetic order?

ton

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How do i create a new worksheet


"csus_tony " wrote in message
...
hello

how do i create a new worksheet in a workbook using code?


ActiveWorkbook.Worksheets.Add

can i also rename the worksheet


ActiveWorkbook.ActiveWorksheet.Name = "Tony"

and put it in alphibetic order?


See Chip Pearson's site at http://www.cpearson.com/excel/sortws.htm


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default How do i create a new worksheet

Dim ws As Worksheet
Set ws = Worksheets.Add
ws.Name = "NewName"

For alphabetical order, look at Chip Pearson's site:

http://www.cpearson.com/excel/sortws.htm

--

Vasant



"csus_tony " wrote in message
...
hello

how do i create a new worksheet in a workbook using code?

can i also rename the worksheet and put it in alphibetic order?

tony


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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default How do i create a new worksheet

Hi Bob:

You probably meant ActiveSheet rather than ActiveWorksheet :-).

Regards,

Vasant.

(PS Myrna nailed me for the same mistake a couple of years ago.)


"Bob Phillips" wrote in message
...

"csus_tony " wrote in message
...
hello

how do i create a new worksheet in a workbook using code?


ActiveWorkbook.Worksheets.Add

can i also rename the worksheet


ActiveWorkbook.ActiveWorksheet.Name = "Tony"

and put it in alphibetic order?


See Chip Pearson's site at http://www.cpearson.com/excel/sortws.htm




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default How do i create a new worksheet

Hi Vasant,

Caught out by copy and paste again.

Bob

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Hi Bob:

You probably meant ActiveSheet rather than ActiveWorksheet :-).

Regards,

Vasant.

(PS Myrna nailed me for the same mistake a couple of years ago.)


"Bob Phillips" wrote in message
...

"csus_tony " wrote in message
...
hello

how do i create a new worksheet in a workbook using code?


ActiveWorkbook.Worksheets.Add

can i also rename the worksheet


ActiveWorkbook.ActiveWorksheet.Name = "Tony"

and put it in alphibetic order?


See Chip Pearson's site at http://www.cpearson.com/excel/sortws.htm








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How do i create a new worksheet

OK...this works great!

NOW... sort of on the same topic... can anybody help me create a new
workbook to copy 2 of 4 existing worksheets in the original workbook... THEN
name the new workbook and use information from the original workbook to
rename the new workbook? In the perfect world it would also allow the user
to enter in the target folder for the new folder or if none chosen then save
the new file into My documents (in windows 95,98 or XP)... not asking a lot
am I?

Seems that I have hit a wall... since I had a way to do this before using
"sheets array" but since I started filtering information and copying and
pasting it when the macro gets to this spot it stalls... so I'm looking for
another way to do the above...

Any and all suggestions would be greatly appreciated!

Greg

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Dim ws As Worksheet
Set ws = Worksheets.Add
ws.Name = "NewName"

For alphabetical order, look at Chip Pearson's site:

http://www.cpearson.com/excel/sortws.htm

--

Vasant



"csus_tony " wrote in message
...
hello

how do i create a new worksheet in a workbook using code?

can i also rename the worksheet and put it in alphibetic order?

tony


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





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default How do i create a new worksheet

Dim fName as String
Dim fInitName as String
Dim Sh as Worksheet
set sh = ActiveSheet
fInitName = Activesheet.Parent.Worksheet("Sheet2") _
.Range("B9").Value
' copy creates a new workbook with sheet1 and sheet3
worksheets(Array("Sheet1","Sheet3")).Copy
fName = Application.GetSaveAsFilename( _
"InitialFilename:=fInitName, _
FileFilter:="Excel Files (*.xls),*.xls")
if not fName = "False" then
Activeworkbook.SaveAs filename:=fName
End if

This doesn't force the user to use the suggested filename.

If you want to just let the user pick a folder and force a name, see John
Walkenbach's site:

http://j-walk.com/ss/excel/tips/tip29.htm
Selecting a Directory

--
Regards,
Tom Ogilvy


Greg Liber wrote in message
...
OK...this works great!

NOW... sort of on the same topic... can anybody help me create a new
workbook to copy 2 of 4 existing worksheets in the original workbook...

THEN
name the new workbook and use information from the original workbook to
rename the new workbook? In the perfect world it would also allow the

user
to enter in the target folder for the new folder or if none chosen then

save
the new file into My documents (in windows 95,98 or XP)... not asking a

lot
am I?

Seems that I have hit a wall... since I had a way to do this before using
"sheets array" but since I started filtering information and copying and
pasting it when the macro gets to this spot it stalls... so I'm looking

for
another way to do the above...

Any and all suggestions would be greatly appreciated!

Greg

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Dim ws As Worksheet
Set ws = Worksheets.Add
ws.Name = "NewName"

For alphabetical order, look at Chip Pearson's site:

http://www.cpearson.com/excel/sortws.htm

--

Vasant



"csus_tony " wrote in message
...
hello

how do i create a new worksheet in a workbook using code?

can i also rename the worksheet and put it in alphibetic order?

tony


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







  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How do i create a new worksheet

Hi again!
I'm trying to make this work but it keeps getting hung up on the "Excel
part... any ideas? I'm using Office 2000 if that helps...

Thanks again for your help!
Greg

"Tom Ogilvy" wrote in message
...
Dim fName as String
Dim fInitName as String
Dim Sh as Worksheet
set sh = ActiveSheet
fInitName = Activesheet.Parent.Worksheet("Sheet2") _
.Range("B9").Value
' copy creates a new workbook with sheet1 and sheet3
worksheets(Array("Sheet1","Sheet3")).Copy
fName = Application.GetSaveAsFilename( _
"InitialFilename:=fInitName, _
FileFilter:="Excel Files (*.xls),*.xls")
if not fName = "False" then
Activeworkbook.SaveAs filename:=fName
End if

This doesn't force the user to use the suggested filename.

If you want to just let the user pick a folder and force a name, see John
Walkenbach's site:

http://j-walk.com/ss/excel/tips/tip29.htm
Selecting a Directory

--
Regards,
Tom Ogilvy


Greg Liber wrote in message
...
OK...this works great!

NOW... sort of on the same topic... can anybody help me create a new
workbook to copy 2 of 4 existing worksheets in the original workbook...

THEN
name the new workbook and use information from the original workbook to
rename the new workbook? In the perfect world it would also allow the

user
to enter in the target folder for the new folder or if none chosen then

save
the new file into My documents (in windows 95,98 or XP)... not asking a

lot
am I?

Seems that I have hit a wall... since I had a way to do this before

using
"sheets array" but since I started filtering information and copying and
pasting it when the macro gets to this spot it stalls... so I'm looking

for
another way to do the above...

Any and all suggestions would be greatly appreciated!

Greg

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Dim ws As Worksheet
Set ws = Worksheets.Add
ws.Name = "NewName"

For alphabetical order, look at Chip Pearson's site:

http://www.cpearson.com/excel/sortws.htm

--

Vasant



"csus_tony " wrote in

message
...
hello

how do i create a new worksheet in a workbook using code?

can i also rename the worksheet and put it in alphibetic order?

tony


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









  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default How do i create a new worksheet

Ok I figured out the excel thing... but I'm now getting a
"Object doesn't support this property or method"
on line
finitname=Activesheet.parent.worksheet("sheet2")

any ideas?
Thanks in advance for your patience and help!

Greg
"Greg Liber" wrote in message
...
Hi again!
I'm trying to make this work but it keeps getting hung up on the "Excel
part... any ideas? I'm using Office 2000 if that helps...

Thanks again for your help!
Greg

"Tom Ogilvy" wrote in message
...
Dim fName as String
Dim fInitName as String
Dim Sh as Worksheet
set sh = ActiveSheet
fInitName = Activesheet.Parent.Worksheet("Sheet2") _
.Range("B9").Value
' copy creates a new workbook with sheet1 and sheet3
worksheets(Array("Sheet1","Sheet3")).Copy
fName = Application.GetSaveAsFilename( _
"InitialFilename:=fInitName, _
FileFilter:="Excel Files (*.xls),*.xls")
if not fName = "False" then
Activeworkbook.SaveAs filename:=fName
End if

This doesn't force the user to use the suggested filename.

If you want to just let the user pick a folder and force a name, see

John
Walkenbach's site:

http://j-walk.com/ss/excel/tips/tip29.htm
Selecting a Directory

--
Regards,
Tom Ogilvy


Greg Liber wrote in message
...
OK...this works great!

NOW... sort of on the same topic... can anybody help me create a new
workbook to copy 2 of 4 existing worksheets in the original

workbook...
THEN
name the new workbook and use information from the original workbook

to
rename the new workbook? In the perfect world it would also allow the

user
to enter in the target folder for the new folder or if none chosen

then
save
the new file into My documents (in windows 95,98 or XP)... not asking

a
lot
am I?

Seems that I have hit a wall... since I had a way to do this before

using
"sheets array" but since I started filtering information and copying

and
pasting it when the macro gets to this spot it stalls... so I'm

looking
for
another way to do the above...

Any and all suggestions would be greatly appreciated!

Greg

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Dim ws As Worksheet
Set ws = Worksheets.Add
ws.Name = "NewName"

For alphabetical order, look at Chip Pearson's site:

http://www.cpearson.com/excel/sortws.htm

--

Vasant



"csus_tony " wrote in

message
...
hello

how do i create a new worksheet in a workbook using code?

can i also rename the worksheet and put it in alphibetic order?

tony


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











  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default How do i create a new worksheet

Greg,
What do you mean by the "Excel part" ?

Not sure what this line is achieving:
fInitName = Activesheet.Parent.Worksheet("Sheet2").Range("B9") .Value
when you have a reference to sh which is not used.
try to make it clearer which WorkBook is active and which is being copied
to/from.

NickHK


"Greg Liber" wrote in message
...
Hi again!
I'm trying to make this work but it keeps getting hung up on the "Excel
part... any ideas? I'm using Office 2000 if that helps...

Thanks again for your help!
Greg

"Tom Ogilvy" wrote in message
...
Dim fName as String
Dim fInitName as String
Dim Sh as Worksheet
set sh = ActiveSheet
fInitName = Activesheet.Parent.Worksheet("Sheet2") _
.Range("B9").Value
' copy creates a new workbook with sheet1 and sheet3
worksheets(Array("Sheet1","Sheet3")).Copy
fName = Application.GetSaveAsFilename( _
"InitialFilename:=fInitName, _
FileFilter:="Excel Files (*.xls),*.xls")
if not fName = "False" then
Activeworkbook.SaveAs filename:=fName
End if

This doesn't force the user to use the suggested filename.

If you want to just let the user pick a folder and force a name, see

John
Walkenbach's site:

http://j-walk.com/ss/excel/tips/tip29.htm
Selecting a Directory

--
Regards,
Tom Ogilvy


Greg Liber wrote in message
...
OK...this works great!

NOW... sort of on the same topic... can anybody help me create a new
workbook to copy 2 of 4 existing worksheets in the original

workbook...
THEN
name the new workbook and use information from the original workbook

to
rename the new workbook? In the perfect world it would also allow the

user
to enter in the target folder for the new folder or if none chosen

then
save
the new file into My documents (in windows 95,98 or XP)... not asking

a
lot
am I?

Seems that I have hit a wall... since I had a way to do this before

using
"sheets array" but since I started filtering information and copying

and
pasting it when the macro gets to this spot it stalls... so I'm

looking
for
another way to do the above...

Any and all suggestions would be greatly appreciated!

Greg

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Dim ws As Worksheet
Set ws = Worksheets.Add
ws.Name = "NewName"

For alphabetical order, look at Chip Pearson's site:

http://www.cpearson.com/excel/sortws.htm

--

Vasant



"csus_tony " wrote in

message
...
hello

how do i create a new worksheet in a workbook using code?

can i also rename the worksheet and put it in alphibetic order?

tony


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













  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 62
Default How do i create a new worksheet

Greg,

Dim fInitName as String <---- string


fInitName = Activesheet.Parent.Worksheet("Sheet2") <----worksheet

NickHK

"Greg Liber" wrote in message
...
Ok I figured out the excel thing... but I'm now getting a
"Object doesn't support this property or method"
on line
finitname=Activesheet.parent.worksheet("sheet2")

any ideas?
Thanks in advance for your patience and help!

Greg
"Greg Liber" wrote in message
...
Hi again!
I'm trying to make this work but it keeps getting hung up on the "Excel
part... any ideas? I'm using Office 2000 if that helps...

Thanks again for your help!
Greg

"Tom Ogilvy" wrote in message
...
Dim fName as String
Dim fInitName as String
Dim Sh as Worksheet
set sh = ActiveSheet
fInitName = Activesheet.Parent.Worksheet("Sheet2") _
.Range("B9").Value
' copy creates a new workbook with sheet1 and sheet3
worksheets(Array("Sheet1","Sheet3")).Copy
fName = Application.GetSaveAsFilename( _
"InitialFilename:=fInitName, _
FileFilter:="Excel Files (*.xls),*.xls")
if not fName = "False" then
Activeworkbook.SaveAs filename:=fName
End if

This doesn't force the user to use the suggested filename.

If you want to just let the user pick a folder and force a name, see

John
Walkenbach's site:

http://j-walk.com/ss/excel/tips/tip29.htm
Selecting a Directory

--
Regards,
Tom Ogilvy


Greg Liber wrote in message
...
OK...this works great!

NOW... sort of on the same topic... can anybody help me create a new
workbook to copy 2 of 4 existing worksheets in the original

workbook...
THEN
name the new workbook and use information from the original workbook

to
rename the new workbook? In the perfect world it would also allow

the
user
to enter in the target folder for the new folder or if none chosen

then
save
the new file into My documents (in windows 95,98 or XP)... not

asking
a
lot
am I?

Seems that I have hit a wall... since I had a way to do this before

using
"sheets array" but since I started filtering information and copying

and
pasting it when the macro gets to this spot it stalls... so I'm

looking
for
another way to do the above...

Any and all suggestions would be greatly appreciated!

Greg

"Vasant Nanavati" <vasantn *AT* aol *DOT* com wrote in message
...
Dim ws As Worksheet
Set ws = Worksheets.Add
ws.Name = "NewName"

For alphabetical order, look at Chip Pearson's site:

http://www.cpearson.com/excel/sortws.htm

--

Vasant



"csus_tony " wrote in

message
...
hello

how do i create a new worksheet in a workbook using code?

can i also rename the worksheet and put it in alphibetic order?

tony


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













Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Create new workbook and new worksheet and close. Worksheet not sav Patrick Djo Excel Worksheet Functions 0 July 20th 09 07:10 PM
i need to create a 2nd worksheet from my base worksheet Tracy Excel Discussion (Misc queries) 0 April 6th 09 08:17 PM
Macro to Create New Worksheet and Reference Cell in Old Worksheet As Tab Name - "Object Required" Error [email protected] Excel Discussion (Misc queries) 4 September 25th 06 01:35 PM
Can I create a worksheet menu to select each other worksheet pippagrace Excel Discussion (Misc queries) 4 June 23rd 06 01:28 PM
How do I create a worksheet within a worksheet in Excel? Julieee Excel Worksheet Functions 1 December 23rd 05 01:33 AM


All times are GMT +1. The time now is 12:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"