PC Review


Reply
Thread Tools Rate Thread

change sheet name macro

 
 
=?Utf-8?B?V0JUS2JlZXp5?=
Guest
Posts: n/a
 
      22nd Feb 2006
I have a large spreadsheet and I am trying to add a macro that allows me to
add a worksheet AND have an input box pop up so I can name the worksheet
whatever name I need it to be. Is this possible?
 
Reply With Quote
 
 
 
 
=?Utf-8?B?RHVrZSBDYXJleQ==?=
Guest
Posts: n/a
 
      22nd Feb 2006
VERY QUICK & VERY DIRTY

Sub newsheet()
Dim ws As Worksheet
Dim nm As String

Set ws = Worksheets.Add
ws.Name = InputBox("sheet name")
End Sub



"WBTKbeezy" wrote:

> I have a large spreadsheet and I am trying to add a macro that allows me to
> add a worksheet AND have an input box pop up so I can name the worksheet
> whatever name I need it to be. Is this possible?

 
Reply With Quote
 
=?Utf-8?B?V0JUS2JlZXp5?=
Guest
Posts: n/a
 
      22nd Feb 2006
That is perfect, quick and dirty can work sometimes...

Now is there a way to put it in a sepecific place in the workbook?

"Duke Carey" wrote:

> VERY QUICK & VERY DIRTY
>
> Sub newsheet()
> Dim ws As Worksheet
> Dim nm As String
>
> Set ws = Worksheets.Add
> ws.Name = InputBox("sheet name")
> End Sub
>
>
>
> "WBTKbeezy" wrote:
>
> > I have a large spreadsheet and I am trying to add a macro that allows me to
> > add a worksheet AND have an input box pop up so I can name the worksheet
> > whatever name I need it to be. Is this possible?

 
Reply With Quote
 
=?Utf-8?B?RHVrZSBDYXJleQ==?=
Guest
Posts: n/a
 
      22nd Feb 2006
Yup. The .Add method takes optional parameters of Before and/or After, so
you can specify where. In this case it is BEFORE sheet1

Sub newsheet()
Dim ws As Worksheet
Dim nm As String

Set ws = Worksheets.Add(before:=Worksheets("Sheet1"))
ws.Name = InputBox("sheet name")
End Sub


"WBTKbeezy" wrote:

> That is perfect, quick and dirty can work sometimes...
>
> Now is there a way to put it in a sepecific place in the workbook?
>
> "Duke Carey" wrote:
>
> > VERY QUICK & VERY DIRTY
> >
> > Sub newsheet()
> > Dim ws As Worksheet
> > Dim nm As String
> >
> > Set ws = Worksheets.Add
> > ws.Name = InputBox("sheet name")
> > End Sub
> >
> >
> >
> > "WBTKbeezy" wrote:
> >
> > > I have a large spreadsheet and I am trying to add a macro that allows me to
> > > add a worksheet AND have an input box pop up so I can name the worksheet
> > > whatever name I need it to be. Is this possible?

 
Reply With Quote
 
=?Utf-8?B?V0JUS2JlZXp5?=
Guest
Posts: n/a
 
      22nd Feb 2006
Okay getting there... but now is there a way to have an input box for what
sheet you would like it before?

"Duke Carey" wrote:

> Yup. The .Add method takes optional parameters of Before and/or After, so
> you can specify where. In this case it is BEFORE sheet1
>
> Sub newsheet()
> Dim ws As Worksheet
> Dim nm As String
>
> Set ws = Worksheets.Add(before:=Worksheets("Sheet1"))
> ws.Name = InputBox("sheet name")
> End Sub
>
>
> "WBTKbeezy" wrote:
>
> > That is perfect, quick and dirty can work sometimes...
> >
> > Now is there a way to put it in a sepecific place in the workbook?
> >
> > "Duke Carey" wrote:
> >
> > > VERY QUICK & VERY DIRTY
> > >
> > > Sub newsheet()
> > > Dim ws As Worksheet
> > > Dim nm As String
> > >
> > > Set ws = Worksheets.Add
> > > ws.Name = InputBox("sheet name")
> > > End Sub
> > >
> > >
> > >
> > > "WBTKbeezy" wrote:
> > >
> > > > I have a large spreadsheet and I am trying to add a macro that allows me to
> > > > add a worksheet AND have an input box pop up so I can name the worksheet
> > > > whatever name I need it to be. Is this possible?

 
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
Why doesnt it change sheet in the macro lwik@tesco.net Microsoft Excel Worksheet Functions 1 24th Apr 2007 06:06 PM
Automatically run macro on sheet change =?Utf-8?B?U3RldmVu?= Microsoft Excel Programming 1 18th Jun 2005 12:21 AM
Macro to Change Sheet Andrew Microsoft Excel Programming 1 4th May 2004 01:46 AM
Re: Change Sheet By Macro steve Microsoft Excel Programming 0 23rd Jul 2003 04:10 PM
Re: Change Sheet By Macro Tom Ogilvy Microsoft Excel Programming 0 22nd Jul 2003 04:00 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:58 AM.