Have 8 worksheets in workbook. xxx 1, xxx 2, xxx 3, xxx 4, zzz 1, zzz 2, zzz 3, zzz 4
Need a macro to rename each, adding 4 to the number portion so they read xxx 5, xxx 6, etc.
Thanks
Have 8 worksheets in workbook. xxx 1, xxx 2, xxx 3, xxx 4, zzz 1, zzz 2, zzz 3, zzz 4
Need a macro to rename each, adding 4 to the number portion so they read xxx 5, xxx 6, etc.
Thanks
Hi,
Try this code.
Please Login or Register to view this content.
One test is worth a thousand opinions.
Click the * Add Reputation below to say thanks.
or maybe
Please Login or Register to view this content.
If you did not get my note on the problem I encountered please let me know at [email protected]. I work during the day and only get in here late, but do have my email forwarded and could respond to it. While I may not get an opportunity to get in here and pick up / try other options until late, but it does not mean I don't have a real interest in solving the problem.
Thanks for your help!!
Added the one line you suggested, but ended up with tabs now numbered in numeric sequence 1, 2, 3, 4, 5 etc.
I have 4 work sheets XXX Wk 1, XXX Wk 2, XXX Wk 3, XXX Wk 4, and 4 sheets named YYY Wk 1, YYY Wk 2, YYY Wk 3, YYY Wk 4, and 4 worksheets named ZZZ Wk 1, ZZZ Wk 2, ZZZ Wk 3, ZZZ Wk 4. Want to advance the date every 4 weeks, so the ones now reading 1 become 5, if 2, 6, if 3, 7, if 4, 8. Then after 4 weeks the numbers again grow to Wks 9,10, 11 and12 and so on for a full year, with the last number being Wk 52.
Thanks
now it seems understood
try
Please Login or Register to view this content.
Hi,
Try this new code that will deal with a word then a space and 1 or 2 digit numbers.
Please Login or Register to view this content.
Sorry - posted to wrong solution
Last edited by ILoveStMartin; 03-30-2013 at 12:10 AM. Reason: Attached to wrong solution
nilem - it worked - Perfect!
Thank you so much
I will mark it solved as soon as I tell other kind / nice person that was also working on task.
Thanks again
MarvinP - Thanks for trying on this. I go a run time error 13 - type mismatch. Highlighted when I went to debug was the line NewNum = Right(NewName, 2) + 4
One from nilem did work so I am going to mark it solved.
here is the one that did work in case you are interested:
Sub ert()
Dim i&, wsh As Worksheet, s$
With CreateObject("vbscript.regexp")
.Pattern = "\d+"
For Each wsh In ThisWorkbook.Worksheets
s = wsh.Name
If .test(s) Then wsh.Name = .Replace(s, .Execute(s)(0) + 4)
Next
End With
End Sub
Thanks again!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks