Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 26
Default 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
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
Finding second value? bgkgmg Excel Worksheet Functions 6 August 24th 08 05:22 PM
finding enyaw Excel Programming 3 July 19th 06 02:07 PM
finding row 7 antonov Excel Programming 6 December 21st 05 07:14 PM
finding the "end" Julia New Users to Excel 2 September 1st 05 02:38 AM
finding a value tom[_6_] Excel Programming 1 August 11th 04 01:17 AM


All times are GMT +1. The time now is 11:03 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"