#1   Report Post  
Anthony
 
Posts: n/a
Default Macro help - please!

Hi all,
is there a way to copy the name a user inputs (say in cell ref A1) and
create a new worksheet within my current workbook with this 'name' using a
macro ??.
ie
the user inputs Bloggs,Joe into cell ref A1, and once the macro is selected
a new worksheet is created with the 'tab' now changed to Bloggs,Joe - instead
of Sheet1, Sheet2 etc etc
thanks
PSA
I'm a novice -so sorry if this is simple
  #2   Report Post  
Damon Longworth
 
Posts: n/a
Default

Try something similar to:

MyName = Range("A1").Value
Sheets.Add
ActiveSheet.Name = MyName

--
Damon Longworth

Don't miss out on the 2005 Excel User Conference
Sept 16th and 17th
Stockyards Hotel - Ft. Worth, Texas
www.ExcelUserConference.com


"Anthony" wrote in message
...
Hi all,
is there a way to copy the name a user inputs (say in cell ref A1) and
create a new worksheet within my current workbook with this 'name' using a
macro ??.
ie
the user inputs Bloggs,Joe into cell ref A1, and once the macro is
selected
a new worksheet is created with the 'tab' now changed to Bloggs,Joe -
instead
of Sheet1, Sheet2 etc etc
thanks
PSA
I'm a novice -so sorry if this is simple



  #3   Report Post  
tjtjjtjt
 
Posts: n/a
Default

One way:

Sub NewSheet()
Dim x As Worksheet
Set x = ActiveSheet
Sheets.Add
ActiveSheet.Name = x.Range("A1")
End Sub

--
tj


"Anthony" wrote:

Hi all,
is there a way to copy the name a user inputs (say in cell ref A1) and
create a new worksheet within my current workbook with this 'name' using a
macro ??.
ie
the user inputs Bloggs,Joe into cell ref A1, and once the macro is selected
a new worksheet is created with the 'tab' now changed to Bloggs,Joe - instead
of Sheet1, Sheet2 etc etc
thanks
PSA
I'm a novice -so sorry if this is simple

  #4   Report Post  
Anthony
 
Posts: n/a
Default

thanks for help - I'll give it go,
one other thing, I assume if I want also to paste some text into this newly
created worksheet from the first sheet this can also be done,
ie the new worksheet is created and renamed Bloggs,Joe (as this is entered
into cell A1), and cells B2,C3,D4 and copied from this sheet and pasted into
cells X1,Y2,Z3 of the new worksheet.
thanks again

"tjtjjtjt" wrote:

One way:

Sub NewSheet()
Dim x As Worksheet
Set x = ActiveSheet
Sheets.Add
ActiveSheet.Name = x.Range("A1")
End Sub

--
tj


"Anthony" wrote:

Hi all,
is there a way to copy the name a user inputs (say in cell ref A1) and
create a new worksheet within my current workbook with this 'name' using a
macro ??.
ie
the user inputs Bloggs,Joe into cell ref A1, and once the macro is selected
a new worksheet is created with the 'tab' now changed to Bloggs,Joe - instead
of Sheet1, Sheet2 etc etc
thanks
PSA
I'm a novice -so sorry if this is simple

  #5   Report Post  
tjtjjtjt
 
Posts: n/a
Default

Do you have a larger plan in mind? This does what you are asking, but with
more information, someone could probably come up with something better.

Sub NewSheet()
Dim x As Worksheet
Dim y As Worksheet
Dim z As Variant

Set x = ActiveSheet
Sheets.Add
ActiveSheet.Name = x.Range("A1")
Set y = ActiveSheet

z = Array(x.Range("B2"), x.Range("C3"), x.Range("D4"))
y.Range("X1") = z(0)
y.Range("Y2") = z(1)
y.Range("Z3") = z(2)

End Sub

--
tj


"Anthony" wrote:

thanks for help - I'll give it go,
one other thing, I assume if I want also to paste some text into this newly
created worksheet from the first sheet this can also be done,
ie the new worksheet is created and renamed Bloggs,Joe (as this is entered
into cell A1), and cells B2,C3,D4 and copied from this sheet and pasted into
cells X1,Y2,Z3 of the new worksheet.
thanks again

"tjtjjtjt" wrote:

One way:

Sub NewSheet()
Dim x As Worksheet
Set x = ActiveSheet
Sheets.Add
ActiveSheet.Name = x.Range("A1")
End Sub

--
tj


"Anthony" wrote:

Hi all,
is there a way to copy the name a user inputs (say in cell ref A1) and
create a new worksheet within my current workbook with this 'name' using a
macro ??.
ie
the user inputs Bloggs,Joe into cell ref A1, and once the macro is selected
a new worksheet is created with the 'tab' now changed to Bloggs,Joe - instead
of Sheet1, Sheet2 etc etc
thanks
PSA
I'm a novice -so sorry if this is simple



  #6   Report Post  
Anthony
 
Posts: n/a
Default

Hi,
well basically I have several bits of data which has been input by the user
on a 'order form' and I want a macro to create a new worksheet for each new
order placed calling it the name given in cell ref A1. Also I want all the
other data copy/pasted into this new worksheet from the original 'order form'
hope this is clear and thanks for help this far

"tjtjjtjt" wrote:

Do you have a larger plan in mind? This does what you are asking, but with
more information, someone could probably come up with something better.

Sub NewSheet()
Dim x As Worksheet
Dim y As Worksheet
Dim z As Variant

Set x = ActiveSheet
Sheets.Add
ActiveSheet.Name = x.Range("A1")
Set y = ActiveSheet

z = Array(x.Range("B2"), x.Range("C3"), x.Range("D4"))
y.Range("X1") = z(0)
y.Range("Y2") = z(1)
y.Range("Z3") = z(2)

End Sub

--
tj


"Anthony" wrote:

thanks for help - I'll give it go,
one other thing, I assume if I want also to paste some text into this newly
created worksheet from the first sheet this can also be done,
ie the new worksheet is created and renamed Bloggs,Joe (as this is entered
into cell A1), and cells B2,C3,D4 and copied from this sheet and pasted into
cells X1,Y2,Z3 of the new worksheet.
thanks again

"tjtjjtjt" wrote:

One way:

Sub NewSheet()
Dim x As Worksheet
Set x = ActiveSheet
Sheets.Add
ActiveSheet.Name = x.Range("A1")
End Sub

--
tj


"Anthony" wrote:

Hi all,
is there a way to copy the name a user inputs (say in cell ref A1) and
create a new worksheet within my current workbook with this 'name' using a
macro ??.
ie
the user inputs Bloggs,Joe into cell ref A1, and once the macro is selected
a new worksheet is created with the 'tab' now changed to Bloggs,Joe - instead
of Sheet1, Sheet2 etc etc
thanks
PSA
I'm a novice -so sorry if this is simple

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
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
Macro and sub rountines The Good Deeds Team Excel Discussion (Misc queries) 1 March 23rd 05 11:26 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM
Macro and If Statement SATB Excel Discussion (Misc queries) 2 December 3rd 04 04:46 PM


All times are GMT +1. The time now is 04:40 PM.

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

About Us

"It's about Microsoft Excel"