A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

how to create a new sheet when adding values in column if it not e



 
 
Thread Tools Display Modes
  #1  
Old December 23rd, 2009, 09:22 AM posted to microsoft.public.excel.misc
Mahdi
external usenet poster
 
Posts: 2
Default how to create a new sheet when adding values in column if it not e

What i want to do , is to make excel to create a new sheet, with the name of
the content of the cells in a defined column.

so that when i edit a new cell in that column, excel will create a new sheet
with the name of the sheet being equal to the content i entered in the cell.

that is the main question.

and after that :
- how to check if the sheet is already created with that name ?!

Thanks in advance.
  #2  
Old December 23rd, 2009, 09:33 AM posted to microsoft.public.excel.misc
Jacob Skaria
external usenet poster
 
Posts: 5,952
Default how to create a new sheet when adding values in column if it not e

Select the sheet tab which you want to work with. Right click the sheet tab
and click on 'View Code'. This will launch VBE. Paste the below code to the
right blank portion. Get back to to workbook and try out.


Private Sub Worksheet_Change(ByVal Target As Range)
Dim ws As Worksheet, wsActive As Worksheet
On Error Resume Next

If Target.Address = "$A$1" Then
Set ws = Worksheets(CStr(Range("A1")))
If ws Is Nothing Then
Application.EnableEvents = False
Set wsActive = ActiveSheet
Set ws = Sheets.Add(After:=Sheets(Sheets.Count))
ws.Name = CStr(Range("A1"))
wsActive.Activate
Application.EnableEvents = True
End If
End If
End Sub

--
Jacob


"Mahdi" wrote:

What i want to do , is to make excel to create a new sheet, with the name of
the content of the cells in a defined column.

so that when i edit a new cell in that column, excel will create a new sheet
with the name of the sheet being equal to the content i entered in the cell.

that is the main question.

and after that :
- how to check if the sheet is already created with that name ?!

Thanks in advance.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


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


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.