View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Renaming Worksheets

Hi TC,

This is not default behaviour but is, I suspect, caused by the code used to
combine the workbooks.

Try:

'=============
Public Sub Tester()
Dim WB As Workbook
Dim sh As Worksheet

Set WB = ActiveWorkbook '<<==== CHANGE

For Each sh In WB.Worksheets
If LCase(Right(sh.Name, 4)) = ".xls" Then
sh.Name = Left(sh.Name, Len(sh.Name) - 4)
End If
Next

End Sub
'<<=============


---
Regards,
Norman


"tcgaines" wrote in
message ...

After combining worksheets from different workbooks, the name of the
worksheets, by default, is the name of the workbook, ie: products.xls.
There are many worksheets. I want to implement a loop that will will
remove ".xls" from each of the worksheet names. any thoughts?

Thanks.


--
tcgaines
------------------------------------------------------------------------
tcgaines's Profile:
http://www.excelforum.com/member.php...o&userid=29608
View this thread: http://www.excelforum.com/showthread...hreadid=493879