rename default sheet numbers

T

terilad

Hi,

I have over 100 sheets in a workbook and through time they have been moved
around therefore default sheet numbers are all mixed, the sheets have names
and are in alphabetical order 1 to 110, is there a way to rename all the
sheets from 1 to 110 in there order as default sheet1 and so on to sheet110.

Thanks


Mark
 
L

Luke M

'Try this macro:

'=============
Sub ReSequence()
'Destroy old names
For Each ws In ThisWorkbook.Worksheets
ws.Name = ws.Name & "xxxxxx"
Next
i = 1
'Give new names
For Each ws In ThisWorkbook.Worksheets
ws.Name = "Sheet" & i
i = i + 1
Next
End Sub
'===========

If you're new to macros:

Debra Dalgleish has some notes how to implement macros here:
http://www.contextures.com/xlvba01.html

David McRitchie has an intro to macros:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Ron de Bruin's intro to macros:
http://www.rondebruin.nl/code.htm

(General, Regular and Standard modules all describe the same thing.)
 
T

terilad

This not working for what I need it to do, it is renaming the sheet tabs but
not the actual sheet numbers by default in VBA, the sheet has a name but also
has a number in brackets, this is what I need to reset.

Any ideas

Mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top