Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Macro to copy a worksheet and rename based upon text entered in 1

Hi,

I am sure this has been asked elsewhere on this forum but I cant find the
answer that I need.

I have a template worksheet created in Excel which people can fill out to
specify an analysis.
My aim is to have a cell where the user enters a new worksheet name so that
when they click on a button it copies the worksheet and renames it to the
current name plus what they entered into the cell.
For example my template worksheet is called "ABC". If the user enters "1_EE"
into cell A2 and then activate the macro it creates a copy of the worksheet
called "ABC 1_EE".

Any ideas?

Also, soon I will be developing a workbook which will need to link to
multiple documents. These links will need to be updated every month and I am
planning on setting it up in the following way:

All formulas / links to the external source are set to month 1s names and
locations such as XXXXX, YYYY, ZZZZ etc
On a front page I plan to have a series of cells where the user enters the
current link and the new link:
Cell A1: Current Cell A2: XXXX
Cell A1: New Cell A3: 1111

I want to create a macro that does a Find and replace in the whole workbook
that looks for the data in A2 and replaces all instances with the data from
A3.

Any thoughts?

Thanks in advance for your help on either / both topics?

Ed
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,276
Default Macro to copy a worksheet and rename based upon text entered in 1

Hi,
first you need to get the worksheet name so let's say in cell A1 copy this
formula
=MID(CELL("filename",C1),FIND("]",CELL("filename",C1))+1,255)
now in A2 the user will enter 1_EE, in cell A3 enter
=A1&" "&A2
now you have the name of the worksheet you want to create

Sub Add_Sheets22()
Dim rCell As Range
For Each rCell In Range("A3")
With Worksheets.Add(After:=Worksheets(Worksheets.Count) )
.Name = rCell.Value
End With
Next rCell
End Sub
Then select your sheet and copy it in the new worksheet created



"edeaston" wrote:

Hi,

I am sure this has been asked elsewhere on this forum but I cant find the
answer that I need.

I have a template worksheet created in Excel which people can fill out to
specify an analysis.
My aim is to have a cell where the user enters a new worksheet name so that
when they click on a button it copies the worksheet and renames it to the
current name plus what they entered into the cell.
For example my template worksheet is called "ABC". If the user enters "1_EE"
into cell A2 and then activate the macro it creates a copy of the worksheet
called "ABC 1_EE".

Any ideas?

Also, soon I will be developing a workbook which will need to link to
multiple documents. These links will need to be updated every month and I am
planning on setting it up in the following way:

All formulas / links to the external source are set to month 1s names and
locations such as XXXXX, YYYY, ZZZZ etc
On a front page I plan to have a series of cells where the user enters the
current link and the new link:
Cell A1: Current Cell A2: XXXX
Cell A1: New Cell A3: 1111

I want to create a macro that does a Find and replace in the whole workbook
that looks for the data in A2 and replaces all instances with the data from
A3.

Any thoughts?

Thanks in advance for your help on either / both topics?

Ed

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Macro to copy a worksheet and rename based upon text entered i

Hi Eduardo,

Thanks for your help. Is there any way of doing this so that I dont have to
copy the data onto the newly created sheet?

The users of this document will not necessarily be Excel-literate so I
wanted to make it as easy as possible for them.

Thanks

Ed

"Eduardo" wrote:

Hi,
first you need to get the worksheet name so let's say in cell A1 copy this
formula
=MID(CELL("filename",C1),FIND("]",CELL("filename",C1))+1,255)
now in A2 the user will enter 1_EE, in cell A3 enter
=A1&" "&A2
now you have the name of the worksheet you want to create

Sub Add_Sheets22()
Dim rCell As Range
For Each rCell In Range("A3")
With Worksheets.Add(After:=Worksheets(Worksheets.Count) )
.Name = rCell.Value
End With
Next rCell
End Sub
Then select your sheet and copy it in the new worksheet created



"edeaston" wrote:

Hi,

I am sure this has been asked elsewhere on this forum but I cant find the
answer that I need.

I have a template worksheet created in Excel which people can fill out to
specify an analysis.
My aim is to have a cell where the user enters a new worksheet name so that
when they click on a button it copies the worksheet and renames it to the
current name plus what they entered into the cell.
For example my template worksheet is called "ABC". If the user enters "1_EE"
into cell A2 and then activate the macro it creates a copy of the worksheet
called "ABC 1_EE".

Any ideas?

Also, soon I will be developing a workbook which will need to link to
multiple documents. These links will need to be updated every month and I am
planning on setting it up in the following way:

All formulas / links to the external source are set to month 1s names and
locations such as XXXXX, YYYY, ZZZZ etc
On a front page I plan to have a series of cells where the user enters the
current link and the new link:
Cell A1: Current Cell A2: XXXX
Cell A1: New Cell A3: 1111

I want to create a macro that does a Find and replace in the whole workbook
that looks for the data in A2 and replaces all instances with the data from
A3.

Any thoughts?

Thanks in advance for your help on either / both topics?

Ed

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,276
Default Macro to copy a worksheet and rename based upon text entered i

Hi Ed,
here is the code to copy your spreadsheet into the new one
Sheets("youroriginal sheet").Select
Cells.Select
Selection.Copy

workbooktab = Range("A3").Value
Worksheets(workbooktab).Select
Range("A3").Select
ActiveSheet.Paste
Application.CutCopyMode = False


End Sub


"edeaston" wrote:

Hi Eduardo,

Thanks for your help. Is there any way of doing this so that I dont have to
copy the data onto the newly created sheet?

The users of this document will not necessarily be Excel-literate so I
wanted to make it as easy as possible for them.

Thanks

Ed

"Eduardo" wrote:

Hi,
first you need to get the worksheet name so let's say in cell A1 copy this
formula
=MID(CELL("filename",C1),FIND("]",CELL("filename",C1))+1,255)
now in A2 the user will enter 1_EE, in cell A3 enter
=A1&" "&A2
now you have the name of the worksheet you want to create

Sub Add_Sheets22()
Dim rCell As Range
For Each rCell In Range("A3")
With Worksheets.Add(After:=Worksheets(Worksheets.Count) )
.Name = rCell.Value
End With
Next rCell
End Sub
Then select your sheet and copy it in the new worksheet created



"edeaston" wrote:

Hi,

I am sure this has been asked elsewhere on this forum but I cant find the
answer that I need.

I have a template worksheet created in Excel which people can fill out to
specify an analysis.
My aim is to have a cell where the user enters a new worksheet name so that
when they click on a button it copies the worksheet and renames it to the
current name plus what they entered into the cell.
For example my template worksheet is called "ABC". If the user enters "1_EE"
into cell A2 and then activate the macro it creates a copy of the worksheet
called "ABC 1_EE".

Any ideas?

Also, soon I will be developing a workbook which will need to link to
multiple documents. These links will need to be updated every month and I am
planning on setting it up in the following way:

All formulas / links to the external source are set to month 1s names and
locations such as XXXXX, YYYY, ZZZZ etc
On a front page I plan to have a series of cells where the user enters the
current link and the new link:
Cell A1: Current Cell A2: XXXX
Cell A1: New Cell A3: 1111

I want to create a macro that does a Find and replace in the whole workbook
that looks for the data in A2 and replaces all instances with the data from
A3.

Any thoughts?

Thanks in advance for your help on either / both topics?

Ed

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15
Default Macro to copy a worksheet and rename based upon text entered i

Perfect - thanks, that solved it!

"Eduardo" wrote:

Hi Ed,
here is the code to copy your spreadsheet into the new one
Sheets("youroriginal sheet").Select
Cells.Select
Selection.Copy

workbooktab = Range("A3").Value
Worksheets(workbooktab).Select
Range("A3").Select
ActiveSheet.Paste
Application.CutCopyMode = False


End Sub


"edeaston" wrote:

Hi Eduardo,

Thanks for your help. Is there any way of doing this so that I dont have to
copy the data onto the newly created sheet?

The users of this document will not necessarily be Excel-literate so I
wanted to make it as easy as possible for them.

Thanks

Ed

"Eduardo" wrote:

Hi,
first you need to get the worksheet name so let's say in cell A1 copy this
formula
=MID(CELL("filename",C1),FIND("]",CELL("filename",C1))+1,255)
now in A2 the user will enter 1_EE, in cell A3 enter
=A1&" "&A2
now you have the name of the worksheet you want to create

Sub Add_Sheets22()
Dim rCell As Range
For Each rCell In Range("A3")
With Worksheets.Add(After:=Worksheets(Worksheets.Count) )
.Name = rCell.Value
End With
Next rCell
End Sub
Then select your sheet and copy it in the new worksheet created



"edeaston" wrote:

Hi,

I am sure this has been asked elsewhere on this forum but I cant find the
answer that I need.

I have a template worksheet created in Excel which people can fill out to
specify an analysis.
My aim is to have a cell where the user enters a new worksheet name so that
when they click on a button it copies the worksheet and renames it to the
current name plus what they entered into the cell.
For example my template worksheet is called "ABC". If the user enters "1_EE"
into cell A2 and then activate the macro it creates a copy of the worksheet
called "ABC 1_EE".

Any ideas?

Also, soon I will be developing a workbook which will need to link to
multiple documents. These links will need to be updated every month and I am
planning on setting it up in the following way:

All formulas / links to the external source are set to month 1s names and
locations such as XXXXX, YYYY, ZZZZ etc
On a front page I plan to have a series of cells where the user enters the
current link and the new link:
Cell A1: Current Cell A2: XXXX
Cell A1: New Cell A3: 1111

I want to create a macro that does a Find and replace in the whole workbook
that looks for the data in A2 and replaces all instances with the data from
A3.

Any thoughts?

Thanks in advance for your help on either / both topics?

Ed



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,276
Default Macro to copy a worksheet and rename based upon text entered i

Your welcome, If this post helps you please say yes to the question. thank you

"edeaston" wrote:

Perfect - thanks, that solved it!

"Eduardo" wrote:

Hi Ed,
here is the code to copy your spreadsheet into the new one
Sheets("youroriginal sheet").Select
Cells.Select
Selection.Copy

workbooktab = Range("A3").Value
Worksheets(workbooktab).Select
Range("A3").Select
ActiveSheet.Paste
Application.CutCopyMode = False


End Sub


"edeaston" wrote:

Hi Eduardo,

Thanks for your help. Is there any way of doing this so that I dont have to
copy the data onto the newly created sheet?

The users of this document will not necessarily be Excel-literate so I
wanted to make it as easy as possible for them.

Thanks

Ed

"Eduardo" wrote:

Hi,
first you need to get the worksheet name so let's say in cell A1 copy this
formula
=MID(CELL("filename",C1),FIND("]",CELL("filename",C1))+1,255)
now in A2 the user will enter 1_EE, in cell A3 enter
=A1&" "&A2
now you have the name of the worksheet you want to create

Sub Add_Sheets22()
Dim rCell As Range
For Each rCell In Range("A3")
With Worksheets.Add(After:=Worksheets(Worksheets.Count) )
.Name = rCell.Value
End With
Next rCell
End Sub
Then select your sheet and copy it in the new worksheet created



"edeaston" wrote:

Hi,

I am sure this has been asked elsewhere on this forum but I cant find the
answer that I need.

I have a template worksheet created in Excel which people can fill out to
specify an analysis.
My aim is to have a cell where the user enters a new worksheet name so that
when they click on a button it copies the worksheet and renames it to the
current name plus what they entered into the cell.
For example my template worksheet is called "ABC". If the user enters "1_EE"
into cell A2 and then activate the macro it creates a copy of the worksheet
called "ABC 1_EE".

Any ideas?

Also, soon I will be developing a workbook which will need to link to
multiple documents. These links will need to be updated every month and I am
planning on setting it up in the following way:

All formulas / links to the external source are set to month 1s names and
locations such as XXXXX, YYYY, ZZZZ etc
On a front page I plan to have a series of cells where the user enters the
current link and the new link:
Cell A1: Current Cell A2: XXXX
Cell A1: New Cell A3: 1111

I want to create a macro that does a Find and replace in the whole workbook
that looks for the data in A2 and replaces all instances with the data from
A3.

Any thoughts?

Thanks in advance for your help on either / both topics?

Ed

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
Copy worksheet and rename sheet Ernst - EXE Graphics Excel Discussion (Misc queries) 4 July 25th 08 02:18 PM
Copy, Paste and Rename a Range using a macro [email protected] Excel Discussion (Misc queries) 1 April 15th 08 04:58 PM
Macro REQ: Automatically copy a template sheet and rename MCSmarties Excel Worksheet Functions 5 October 11th 07 10:18 PM
Rename worksheet in macro JBW Excel Worksheet Functions 1 September 24th 07 06:58 PM
rename worksheet based on contents of a cell in different workshee OfficeNDN Excel Discussion (Misc queries) 1 May 18th 07 07:02 AM


All times are GMT +1. The time now is 05:54 AM.

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"