Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Rename worksheets

I have 286 tables which each has different worksheets name (30 character )
and contains space such as : "Zone 1 San Diego 2003_12_08 to "
and I have to change all of those worksheets into a name like sheet1
Is there any batch files to change all those files at once using ActiveX
script or any other methods?


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Rename worksheets


For Each sh In Activeworkbbok.Worksheets
sh.NAme = "Sheet" & i+1
i = i + 1
Next sh

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Senjaya" wrote in message
...
I have 286 tables which each has different worksheets name (30 character )
and contains space such as : "Zone 1 San Diego 2003_12_08 to "
and I have to change all of those worksheets into a name like sheet1
Is there any batch files to change all those files at once using ActiveX
script or any other methods?




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 983
Default Rename worksheets

Sub ReNameSheets()
Dim wks As Worksheet
Dim intName As Integer

intName = 1
For Each wks In Worksheets
wks.Name = "Sheet" & intName
intName = intName + 1
Next wks

End Sub

HTH

"Senjaya" wrote:

I have 286 tables which each has different worksheets name (30 character )
and contains space such as : "Zone 1 San Diego 2003_12_08 to "
and I have to change all of those worksheets into a name like sheet1
Is there any batch files to change all those files at once using ActiveX
script or any other methods?



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Rename worksheets

Actually I have to apply the code to the DTS package which I realize
only can accept the VB ActiveX script only not the regular VB code.
And on each excel file only have 1 worksheet.
I try this methods below to rename them but somehow have a problem to
rename worksheet which have 30 char such as :
"Zone 1 San Diego 2003_12_08 to "


Function Main()
'use script to rename all sheets to a common name
dim xlObj
Set xlObj = CreateObject("Excel.application")
xlObj.Workbooks.Open
DTSGlobalVariables("gv_FileFullName").value
xlObj.ActiveWorkbook.Sheets(1).Name = "DataSheet"
xlObj.ActiveWorkbook.Save
xlObj.Quit
Set xlObj = Nothing
Main = DTSTaskExecResult_Success
End Function

Please help again and thank in advance -

*** Sent via Developersdex http://www.developersdex.com ***
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
Rename Many Worksheets at a time. Shahzad Zameer Excel Discussion (Misc queries) 9 January 6th 07 02:15 PM
rename worksheets after copy Qaspec Excel Programming 2 February 2nd 05 02:45 PM
Can I batch rename new worksheets Harry Limey New Users to Excel 3 January 19th 05 09:19 PM
Mass rename of worksheets/Workbooks Patrick Molloy[_9_] Excel Programming 0 September 3rd 03 05:10 PM


All times are GMT +1. The time now is 09:37 PM.

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"