PC Review


Reply
Thread Tools Rate Thread

Creating a new worksheet

 
 
JasonK
Guest
Posts: n/a
 
      3rd Jan 2010
TIA boys and girls.


I need a macro that will create a worksheet titled what ever the user
wants to name it.

I would guess that means it would open a dialog box and then name the
sheet what the user writes in the box. I just can't figure out how to
do it.

Thanks for all your help,

JasonK


 
Reply With Quote
 
 
 
 
Gord Dibben
Guest
Posts: n/a
 
      3rd Jan 2010
Sub newsheet()
Dim shtname as String
shtname = InputBox("Type a name")
ActiveWorkbook.Worksheets.Add
ActiveSheet.Name = shtname
End Sub


Gord Dibben MS Excel MVP

On Sun, 03 Jan 2010 11:44:15 -0800, JasonK <(E-Mail Removed)> wrote:

>TIA boys and girls.
>
>
>I need a macro that will create a worksheet titled what ever the user
>wants to name it.
>
>I would guess that means it would open a dialog box and then name the
>sheet what the user writes in the box. I just can't figure out how to
>do it.
>
>Thanks for all your help,
>
>JasonK
>


 
Reply With Quote
 
OssieMac
Guest
Posts: n/a
 
      3rd Jan 2010
Just for interest you can also add the sheet and name it in one line.

ActiveWorkbook.Worksheets.Add.Name = shtName

--
Regards,

OssieMac


"Gord Dibben" wrote:

> Sub newsheet()
> Dim shtname as String
> shtname = InputBox("Type a name")
> ActiveWorkbook.Worksheets.Add
> ActiveSheet.Name = shtname
> End Sub
>
>
> Gord Dibben MS Excel MVP
>
> On Sun, 03 Jan 2010 11:44:15 -0800, JasonK <(E-Mail Removed)> wrote:
>
> >TIA boys and girls.
> >
> >
> >I need a macro that will create a worksheet titled what ever the user
> >wants to name it.
> >
> >I would guess that means it would open a dialog box and then name the
> >sheet what the user writes in the box. I just can't figure out how to
> >do it.
> >
> >Thanks for all your help,
> >
> >JasonK
> >

>
> .
>

 
Reply With Quote
 
JasonK
Guest
Posts: n/a
 
      3rd Jan 2010
Thanks OssieMac --

On Sun, 3 Jan 2010 13:29:01 -0800, OssieMac
<(E-Mail Removed)> wrote:

>Just for interest you can also add the sheet and name it in one line.
>
>ActiveWorkbook.Worksheets.Add.Name = shtName


 
Reply With Quote
 
JasonK
Guest
Posts: n/a
 
      3rd Jan 2010
Thanks Gord -- worked perfectly


On Sun, 03 Jan 2010 12:27:27 -0800, Gord Dibben <gorddibbATshawDOTca>
wrote:

>Sub newsheet()
>Dim shtname as String
> shtname = InputBox("Type a name")
> ActiveWorkbook.Worksheets.Add
> ActiveSheet.Name = shtname
>End Sub
>
>
>Gord Dibben MS Excel MVP
>
>On Sun, 03 Jan 2010 11:44:15 -0800, JasonK <(E-Mail Removed)> wrote:
>
>>TIA boys and girls.
>>
>>
>>I need a macro that will create a worksheet titled what ever the user
>>wants to name it.
>>
>>I would guess that means it would open a dialog box and then name the
>>sheet what the user writes in the box. I just can't figure out how to
>>do it.
>>
>>Thanks for all your help,
>>
>>JasonK
>>


 
Reply With Quote
 
Gord Dibben
Guest
Posts: n/a
 
      4th Jan 2010
Good point.

Thanks, Gord

On Sun, 3 Jan 2010 13:29:01 -0800, OssieMac
<(E-Mail Removed)> wrote:

>Just for interest you can also add the sheet and name it in one line.
>
>ActiveWorkbook.Worksheets.Add.Name = shtName


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating or going to a worksheet =?Utf-8?B?c2RnODQ4MQ==?= Microsoft Excel Programming 3 25th Feb 2006 01:42 PM
creating a worksheet in a worksheet? skaskaska Microsoft Excel Misc 1 5th Aug 2004 09:23 PM
Creating a Worksheet in VBA Jako Microsoft Excel Programming 1 8th Jun 2004 11:09 PM
Creating a new worksheet from another Sheeny Microsoft Excel Programming 2 25th May 2004 06:14 PM
Creating a viewport of a worksheet/selection on another worksheet spidey3721 Microsoft Excel Discussion 0 27th Aug 2003 09:17 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:28 AM.