Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On Nov 20, 11:33 am, Joel wrote:
Dan: When you use wroksheet.add you must use either the after:= or befo=. Otherwise, the new worksheet is put in a new workbook. See my last posting. "Dan R." wrote: Jay, Here's one way: Private Sub CommandButton1_Click() Dim lRow As Long, i As Range Dim sh As Worksheet, sh2 As Worksheet Dim exists As Boolean lRow = Range("A65536").End(xlUp).Row Set rng = Range(Cells(1, 1), Cells(lRow, 1)) For Each i In rng For Each sh In ThisWorkbook.Worksheets If sh.Name = i Then exists = True Exit For Else exists = False End If Next sh If exists = False Then Set sh2 = Sheets.Add sh2.Name = i End If Next i End Sub -- Dan- Hide quoted text - - Show quoted text - Thanks Joel, but it works fine without. -- Dan |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
VBA Help naming sheets | Excel Discussion (Misc queries) | |||
naming sheets | Excel Programming | |||
Macro for naming sheets? | Excel Discussion (Misc queries) | |||
naming sheets | Excel Programming | |||
Naming Sheets Tabs | Excel Worksheet Functions |