![]() |
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 |
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 |
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 |
All times are GMT +1. The time now is 11:08 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com