Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Making sheets with a macro

Hello everybody. I could really use some help with trying to do this.
I have run into an issue where i want to be able to create multiple
sheets with a macro. I am trying to create a macro that can be used to
see if a sheet "Insert Name" exists. The once it is verified then
create an additional sheet called "Something Else". Also, I want to it
to only add one planned sheet each time you run the macro and to name
each new sheet differently. I would like to be able to do this for up
to six new sheets. Is this even possible? If it is not possible please
tell me so I do not waste more time trying. If it is possible I would
really appreciate some help or hints on this subject.


-James-

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Making sheets with a macro

Hi James,

Sub Test()
Dim i As Long
Dim wks As Worksheet

On Error Resume Next

Set wks = ActiveWorkbook.Worksheets("Insert Name")

If wks Is Nothing Then
Set wks = ActiveWorkbook.Worksheets.Add
wks.Move after:=Sheets(Sheets.Count)
wks.Name = "Insert Name"
End If

Err.Clear
For i = 1 To 6
Set wks = Worksheets("Something Else" & i)
If Err.Number Then
Exit For
Else
Err.Clear
End If
Next

On Error GoTo 0
If i = 7 Then
MsgBox "already 6"
Else
Worksheets.Add.Move after:=wks
ActiveSheet.Name = "Something Else" & i
End If
End Sub

Regards,
Peter T

"JamesJordan" wrote in message
ups.com...
Hello everybody. I could really use some help with trying to do this.
I have run into an issue where i want to be able to create multiple
sheets with a macro. I am trying to create a macro that can be used to
see if a sheet "Insert Name" exists. The once it is verified then
create an additional sheet called "Something Else". Also, I want to it
to only add one planned sheet each time you run the macro and to name
each new sheet differently. I would like to be able to do this for up
to six new sheets. Is this even possible? If it is not possible please
tell me so I do not waste more time trying. If it is possible I would
really appreciate some help or hints on this subject.


-James-



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Making sheets with a macro

Thanks I will try that out. That should give me a good start. I will
already have a couple of sheets in the workbook. Also, I am messing
with a macro to create a corresponding sheet for each sheet that is
created. What it is, is that I will use the code you gave me to create
a macro that makes multiple planned pages and then I hope to be able to
run the another macro to create a planned vs. actual sheet for each of
the planned sheets that exist. I appreciate your help!

-James-

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
making changes to existing sheets zeerog New Users to Excel 2 January 2nd 07 11:52 AM
making changes to all sheets in a workbook Wayne Cameron Excel Discussion (Misc queries) 2 January 20th 06 04:56 AM
Making sheets visible / hidden Xlyr Excel Programming 1 March 6th 05 07:45 PM
making an employee schedule in two sheets dankeith Excel Worksheet Functions 1 December 16th 04 04:10 AM
Making a function available in all sheets George Andrews Excel Programming 1 February 6th 04 11:16 PM


All times are GMT +1. The time now is 01:09 AM.

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

About Us

"It's about Microsoft Excel"