close

I have a large spreadsheet and I am trying to add a macro that allows me to
add a worksheet AND have an input box pop up so I can name the worksheet
whatever name I need it to be. Is this possible?

VERY QUICK amp; VERY DIRTY

Sub newsheet()
Dim ws As Worksheet
Dim nm As String

Set ws = Worksheets.Add
ws.Name = InputBox(quot;sheet namequot;)
End Sub
quot;WBTKbeezyquot; wrote:

gt; I have a large spreadsheet and I am trying to add a macro that allows me to
gt; add a worksheet AND have an input box pop up so I can name the worksheet
gt; whatever name I need it to be. Is this possible?

That is perfect, quick and dirty can work sometimes...

Now is there a way to put it in a sepecific place in the workbook?

quot;Duke Careyquot; wrote:

gt; VERY QUICK amp; VERY DIRTY
gt;
gt; Sub newsheet()
gt; Dim ws As Worksheet
gt; Dim nm As String
gt;
gt; Set ws = Worksheets.Add
gt; ws.Name = InputBox(quot;sheet namequot;)
gt; End Sub
gt;
gt;
gt;
gt; quot;WBTKbeezyquot; wrote:
gt;
gt; gt; I have a large spreadsheet and I am trying to add a macro that allows me to
gt; gt; add a worksheet AND have an input box pop up so I can name the worksheet
gt; gt; whatever name I need it to be. Is this possible?

Yup. The .Add method takes optional parameters of Before and/or After, so
you can specify where. In this case it is BEFORE sheet1

Sub newsheet()
Dim ws As Worksheet
Dim nm As String

Set ws = Worksheets.Add(befo=Worksheets(quot;Sheet1quot;))
ws.Name = InputBox(quot;sheet namequot;)
End Subquot;WBTKbeezyquot; wrote:

gt; That is perfect, quick and dirty can work sometimes...
gt;
gt; Now is there a way to put it in a sepecific place in the workbook?
gt;
gt; quot;Duke Careyquot; wrote:
gt;
gt; gt; VERY QUICK amp; VERY DIRTY
gt; gt;
gt; gt; Sub newsheet()
gt; gt; Dim ws As Worksheet
gt; gt; Dim nm As String
gt; gt;
gt; gt; Set ws = Worksheets.Add
gt; gt; ws.Name = InputBox(quot;sheet namequot;)
gt; gt; End Sub
gt; gt;
gt; gt;
gt; gt;
gt; gt; quot;WBTKbeezyquot; wrote:
gt; gt;
gt; gt; gt; I have a large spreadsheet and I am trying to add a macro that allows me to
gt; gt; gt; add a worksheet AND have an input box pop up so I can name the worksheet
gt; gt; gt; whatever name I need it to be. Is this possible?

Okay getting there... but now is there a way to have an input box for what
sheet you would like it before?

quot;Duke Careyquot; wrote:

gt; Yup. The .Add method takes optional parameters of Before and/or After, so
gt; you can specify where. In this case it is BEFORE sheet1
gt;
gt; Sub newsheet()
gt; Dim ws As Worksheet
gt; Dim nm As String
gt;
gt; Set ws = Worksheets.Add(befo=Worksheets(quot;Sheet1quot;))
gt; ws.Name = InputBox(quot;sheet namequot;)
gt; End Sub
gt;
gt;
gt; quot;WBTKbeezyquot; wrote:
gt;
gt; gt; That is perfect, quick and dirty can work sometimes...
gt; gt;
gt; gt; Now is there a way to put it in a sepecific place in the workbook?
gt; gt;
gt; gt; quot;Duke Careyquot; wrote:
gt; gt;
gt; gt; gt; VERY QUICK amp; VERY DIRTY
gt; gt; gt;
gt; gt; gt; Sub newsheet()
gt; gt; gt; Dim ws As Worksheet
gt; gt; gt; Dim nm As String
gt; gt; gt;
gt; gt; gt; Set ws = Worksheets.Add
gt; gt; gt; ws.Name = InputBox(quot;sheet namequot;)
gt; gt; gt; End Sub
gt; gt; gt;
gt; gt; gt;
gt; gt; gt;
gt; gt; gt; quot;WBTKbeezyquot; wrote:
gt; gt; gt;
gt; gt; gt; gt; I have a large spreadsheet and I am trying to add a macro that allows me to
gt; gt; gt; gt; add a worksheet AND have an input box pop up so I can name the worksheet
gt; gt; gt; gt; whatever name I need it to be. Is this possible?

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 software 的頭像
    software

    software

    software 發表在 痞客邦 留言(0) 人氣()