Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Coding to check for a sheet name and add it if it's not there

Can someone provide me some code that would check to see if the sheet name "Report" is in the active workbook and if not add it to the end of the sheets, please?

TIA, AlanN
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Coding to check for a sheet name and add it if it's not there

Alan,

Try something like

Dim N As Long
On Error Resume Next
With ThisWorkbook.Worksheets
N = Len(.Item("Report").Name)
If N = 0 Then
.Add(after:=.Item(.Count)).Name = "Report"
End If
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"AlanN" wrote in message
...
Can someone provide me some code that would check to see if the
sheet name "Report" is in the active workbook and if not add it to
the end of the sheets, please?

TIA, AlanN


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Coding to check for a sheet name and add it if it's not there

I tried putting that


Thanks for the macro, Chip. I changed ThisWorkbook to ActiveWorkbook as it
is run from my personal.xls file. It works like a charm.

AlanN

"Chip Pearson" wrote in message
...
Alan,

Try something like

Dim N As Long
On Error Resume Next
With ThisWorkbook.Worksheets
N = Len(.Item("Report").Name)
If N = 0 Then
.Add(after:=.Item(.Count)).Name = "Report"
End If
End With


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"AlanN" wrote in message
...
Can someone provide me some code that would check to see if the
sheet name "Report" is in the active workbook and if not add it to
the end of the sheets, please?

TIA, AlanN




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
backing up formulas in sheet coding? Derrick Excel Discussion (Misc queries) 2 June 24th 09 07:52 PM
work sheet coding Dad Excel Discussion (Misc queries) 3 December 23rd 07 11:08 PM
Check Activesheet for chart sheet or work sheet NSK Charts and Charting in Excel 1 July 17th 07 09:00 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
how to use sumif function to check date in 1 sheet is < 2 sheet Bharat Saboo Excel Worksheet Functions 3 December 30th 05 07:10 AM


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