View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Horacio[_2_] Horacio[_2_] is offline
external usenet poster
 
Posts: 9
Default 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