Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How would I code, if there is worksheet titled something,
select it. If there isn't a worksheet titled that, create it? Thank you. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() If Not IsSheet("mySheet") Then Worksheets.Add.Name = "mySheet" End If Function IsWsSheet(sh As String, Optional wb As Workbook) As Boolean Dim oWs As Worksheet If wb Is Nothing Then Set wb = ActiveWorkbook On Error Resume Next Set oWs = wb.Worksheets(sh) On Error GoTo 0 IsWsSheet = Not oWs Is Nothing End Function -- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) wrote in message ... How would I code, if there is worksheet titled something, select it. If there isn't a worksheet titled that, create it? Thank you. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try some code like the following:
Dim WS As Worksheet On Error Resume Next Set WS = Worksheets("TheSheetName") If WS Is Nothing Then Set WS = Worksheets.Add WS.Name = "TheSheetName" End If WS.Select -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com wrote in message ... How would I code, if there is worksheet titled something, select it. If there isn't a worksheet titled that, create it? Thank you. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
automatically appending newly added data on worksheet to a master list worksheet | Links and Linking in Excel | |||
Unable to Insert Worksheet/Move and copy worksheet Excel 2003 | Excel Worksheet Functions | |||
plot graph from multiple worksheet as embedded chart object on every worksheet | Excel Worksheet Functions | |||
Upload multiple text files into 1 excel worksheet + put the filename as the first column in the worksheet | Excel Worksheet Functions | |||
Attaching a JET database to an Excel Worksheet OR storing large binary data in a worksheet | Excel Programming |