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

I have around 10 worksheets .....5 contains the word "[Trend]" in their
sheet name for example "Product1 [Trend]"

I want a Macro that can search for word "[Trend]" in available worksheets
and delete this word or replace it with some other text..so that worksheet
rename as "Product1".

Is it possible...?

Thank you,
Murtaza


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 857
Default Rename Multiple work sheet

Murtaza,

I don't know how you can have square brackets in your sheet names, but this
code will loop through the sheets and remove "Trend" from the sheet names.

Sub test()
Dim sht As Worksheet

For Each sht In ThisWorkbook.Worksheets
sht.Name = Trim(Replace(sht.Name, "Trend", "", 1, -1, vbTextCompare))
Next sht
End Sub


--
Hope that helps.

Vergel Adriano


"Murtaza" wrote:

I have around 10 worksheets .....5 contains the word "[Trend]" in their
sheet name for example "Product1 [Trend]"

I want a Macro that can search for word "[Trend]" in available worksheets
and delete this word or replace it with some other text..so that worksheet
rename as "Product1".

Is it possible...?

Thank you,
Murtaza



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Rename Multiple work sheet

Dear Adriano: (what does this name means)
Its not that difficult....you can safely type "anytext [Trend]" as a sheet
name and Excel will accept....but I am suffering this [] when linking the
cells in diffrent workbook.

Therefore I want to remove this sq bracket.

Thanks for your simple/short code....I hope it will help.



"Vergel Adriano" wrote in message
...
Murtaza,

I don't know how you can have square brackets in your sheet names, but

this
code will loop through the sheets and remove "Trend" from the sheet names.

Sub test()
Dim sht As Worksheet

For Each sht In ThisWorkbook.Worksheets
sht.Name = Trim(Replace(sht.Name, "Trend", "", 1, -1,

vbTextCompare))
Next sht
End Sub


--
Hope that helps.

Vergel Adriano


"Murtaza" wrote:

I have around 10 worksheets .....5 contains the word "[Trend]" in their
sheet name for example "Product1 [Trend]"

I want a Macro that can search for word "[Trend]" in available

worksheets
and delete this word or replace it with some other text..so that

worksheet
rename as "Product1".

Is it possible...?

Thank you,
Murtaza





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
how do i rename a sheet if the rename tab is inactive? Nelson Excel Worksheet Functions 1 March 3rd 10 10:28 AM
multiple work sheet data to link in one worksheet MANISH Excel Worksheet Functions 6 February 13th 10 12:16 AM
need a function that will work using multiple work books and sheet capt c Excel Worksheet Functions 1 March 30th 09 10:20 PM
Multiple work sheet merge Zack Excel Discussion (Misc queries) 1 August 26th 08 07:30 PM
Move data to new sheet - rename sheet based on criteria ? [email protected] Excel Discussion (Misc queries) 7 May 16th 07 10:22 PM


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