ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Insert new sheet (https://www.excelbanter.com/excel-programming/423329-insert-new-sheet.html)

Horacio[_2_]

Insert new sheet
 
Hi!
Is there some code to insert a new sheet with the contents of the
selected cell?
Tank you
Horacio

reklamo

Insert new sheet
 
Try following:

Sub InsertSheet()
ActRow = Selection.Row
ActCol = Selection.Column
ActSheetName = ActiveSheet.Name
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
Cells(ActRow, ActCol).Value = Sheets(ActSheetName).Cells(ActRow,
ActCol).Value
End Sub

Regards
reklamo

"Horacio" wrote:

Hi!
Is there some code to insert a new sheet with the contents of the
selected cell?
Tank you
Horacio


Horacio[_2_]

Insert new sheet
 
Sorry
May I´m not have been well explained.
What we seek is a code that do the following:
In sheet 1 wen I select the cell A1 contains "Test", I want the code
insert a new sheet with the name "Test"
Regards
Horacio

reklamo escreveu:
Try following:

Sub InsertSheet()
ActRow = Selection.Row
ActCol = Selection.Column
ActSheetName = ActiveSheet.Name
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
Cells(ActRow, ActCol).Value = Sheets(ActSheetName).Cells(ActRow,
ActCol).Value
End Sub

Regards
reklamo

"Horacio" wrote:

Hi!
Is there some code to insert a new sheet with the contents of the
selected cell?
Tank you
Horacio


reklamo

Insert new sheet
 
Hi Horacio

Try following code:
Sub InsertSheet()
NewSheetName = Selection.Value
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = NewSheetName
End Sub

Regards
reklamo


"Horacio" wrote:

Sorry
May I´m not have been well explained.
What we seek is a code that do the following:
In sheet 1 wen I select the cell A1 contains "Test", I want the code
insert a new sheet with the name "Test"
Regards
Horacio

reklamo escreveu:
Try following:

Sub InsertSheet()
ActRow = Selection.Row
ActCol = Selection.Column
ActSheetName = ActiveSheet.Name
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
Cells(ActRow, ActCol).Value = Sheets(ActSheetName).Cells(ActRow,
ActCol).Value
End Sub

Regards
reklamo

"Horacio" wrote:

Hi!
Is there some code to insert a new sheet with the contents of the
selected cell?
Tank you
Horacio



Horacio[_2_]

Insert new sheet
 
Hi Reklamo!
Thank you, the code is perfect.
Regards
Horacio

reklamo escreveu:
Hi Horacio

Try following code:
Sub InsertSheet()
NewSheetName = Selection.Value
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
ActiveSheet.Name = NewSheetName
End Sub

Regards
reklamo


"Horacio" wrote:

Sorry
May I´m not have been well explained.
What we seek is a code that do the following:
In sheet 1 wen I select the cell A1 contains "Test", I want the code
insert a new sheet with the name "Test"
Regards
Horacio

reklamo escreveu:
Try following:

Sub InsertSheet()
ActRow = Selection.Row
ActCol = Selection.Column
ActSheetName = ActiveSheet.Name
ActiveWorkbook.Sheets.Add After:=Worksheets(Worksheets.Count)
Cells(ActRow, ActCol).Value = Sheets(ActSheetName).Cells(ActRow,
ActCol).Value
End Sub

Regards
reklamo

"Horacio" wrote:

Hi!
Is there some code to insert a new sheet with the contents of the
selected cell?
Tank you
Horacio



All times are GMT +1. The time now is 09:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com