Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding a tab name
I have a list of tab names and data, I can set a string as the tab name and
go to it using Sheets(S1).Select However, if the tab is not found I need to create it, how can this be done? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding a tab name
Try something like this
Dim s1 As String Dim WS As Worksheet s1 = "TEST" Set WS = Nothing On Error Resume Next Set WS = Sheets(s1) On Error GoTo 0 If WS Is Nothing Then Set WS = Worksheets.Add(After:=Worksheets(Worksheets.Count) ) WS.Name = s1 End If HTH, Barb Reinhardt "tigoda" wrote: I have a list of tab names and data, I can set a string as the tab name and go to it using Sheets(S1).Select However, if the tab is not found I need to create it, how can this be done? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
finding a tab name
that works perfectly, thanks!
"Barb Reinhardt" wrote: Try something like this Dim s1 As String Dim WS As Worksheet s1 = "TEST" Set WS = Nothing On Error Resume Next Set WS = Sheets(s1) On Error GoTo 0 If WS Is Nothing Then Set WS = Worksheets.Add(After:=Worksheets(Worksheets.Count) ) WS.Name = s1 End If HTH, Barb Reinhardt "tigoda" wrote: I have a list of tab names and data, I can set a string as the tab name and go to it using Sheets(S1).Select However, if the tab is not found I need to create it, how can this be done? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Finding second value? | Excel Worksheet Functions | |||
finding | Excel Programming | |||
finding row 7 | Excel Programming | |||
finding the "end" | New Users to Excel | |||
finding a value | Excel Programming |