Sub Button1_Click()
inset = Range(quot;B3quot;).Value
Sheets.Add
ActiveSheet.Name = quot;insetquot;
On Error GoTo Dele
Sheets(quot;sdfsquot;).Select
Range(quot;A2quot;).Select
Dele: ActiveSheet.Delete
End Sub
I'm wanting this button to make a new sheet within the workbook, named as
whatever is in B3 on the same sheet as the button. I only want it to do this
if this sheet does not already exist.
Its for recording productivity, and each sheet will be a person, and I want
part of the code to make a new sheet if that person doesn't already have a
sheet, new staff etc.
try this idea from a recent post of mine
Sub mynewsheets()
For Each c In Range(quot;myrangequot;)
On Error Resume Next
If Sheets.Name lt;gt; c Then
Sheets.Add.Name = c
End If
Next c
End Sub
--
Don Guillett
SalesAid Software
quot;PaulWquot; gt; wrote in message
...
gt; Sub Button1_Click()
gt;
gt; inset = Range(quot;B3quot;).Value
gt; Sheets.Add
gt; ActiveSheet.Name = quot;insetquot;
gt; On Error GoTo Dele
gt; Sheets(quot;sdfsquot;).Select
gt; Range(quot;A2quot;).Select
gt;
gt; Dele: ActiveSheet.Delete
gt;
gt; End Sub
gt;
gt; I'm wanting this button to make a new sheet within the workbook, named as
gt; whatever is in B3 on the same sheet as the button. I only want it to do
gt; this
gt; if this sheet does not already exist.
gt;
gt; Its for recording productivity, and each sheet will be a person, and I
gt; want
gt; part of the code to make a new sheet if that person doesn't already have a
gt; sheet, new staff etc.
- Oct 22 Sun 2006 20:09
VBA, Make a new sheet if it doesn't exist
close
全站熱搜
留言列表
發表留言