Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default SHEE1. Duplicate all sheets, making 2 copies of ea. / 2. Add " E"and " F" to end of tab name. / 3. Put all sheets at the very end.

Good Afternoon!

I'm hoping someone can help with a complicated script. I have two
very large workbooks to convert to an English and French version (they
currently have data in both languages, merged). I've thought and
thought about how to handle this about this and the easiest way is to
have Excel create 2 copies of each worksheet, sending those copies to
the end.

This is the the output we would need, from this: SHEET1, SHEET2,
SHEET3 ...

to this: SHEET1, SHEET2, SHEET3 SHEET1 E, SHEET1 F SHEET2 E,
SHEET2 F SHEET3 E, SHEET3 F ... (I don't think any of the tabs are
too long that the extra letter will be truncated out ... ... but
perhaps "error trapping" needed for that; I believe that's what it's
called?)

Can this be done?

Would this starting point help at all (from another script kindly
provided by this ng):

Sub WORKBOOK_Split_into_ENG_and_FRE()

Dim w As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
For Each w In ActiveWorkbook.Worksheets
w.Copy
....

Thanks!!! :oD
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default SHEE1. Duplicate all sheets, making 2 copies of ea. / 2. Add " E"and " F" to end of tab name. / 3. Put all sheets at the very end.

Well, it's just a good thing that I've managed to learn a few tricks
because googling straight questions just doesn't help. I again googled
but on part of the syntax kindly provided for another workbook-
splitting need (something I've learned to do recently), and I came
across something that is close to doing what's needed. Hopefully
someone knows how to modify it because I have wasted so much time
already searching yet I'm not closer to getting a complete solution
<sigh. But this does help:

Googling for the syntax eventually led me he http://support.microsoft.com/kb/288402
where I found this partial result:

-------------------------------------
Sub Copier4()
Dim x As Integer

For x = 1 To ActiveWorkbook.Sheets.Count
'Loop through each of the sheets in the workbook
'by using x as the sheet index number.
ActiveWorkbook.Sheets(x).Copy _
After:=ActiveWorkbook.Sheets(ActiveWorkbook.Sheets .Count)
'Puts all copies after the last existing sheet.
Next
End Sub
-------------------------------------

This script gets me this type of result

Befo
SHEET1, SHEET2, SHEET3

After:
SHEET1, SHEET2, SHEET3, SHEET1 (2), SHEET2 (2), SHEET3 (2)

Not quite there yet, to achieve:
SHEET1, SHEET2, SHEET3, SHEET1 E, SHEET1 F, SHEET2 E, SHEET2 F, SHEET3
E, SHEET3 F

Thank you!! :oD
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 61
Default Duplicate sheets?

On Thu, 3 Sep 2009 12:43:00 -0700 (PDT), StargateFanNotAtHome
wrote:

[snip]


-------------------------------------
Sub Copier4()
Dim x As Integer

For x = 1 To ActiveWorkbook.Sheets.Count
'Loop through each of the sheets in the workbook
'by using x as the sheet index number.
ActiveWorkbook.Sheets(x).Copy _
After:=ActiveWorkbook.Sheets(ActiveWorkbook.Sheets .Count)
'Puts all copies after the last existing sheet.
Next
End Sub
-------------------------------------

This script gets me this type of result

Befo
SHEET1, SHEET2, SHEET3

After:
SHEET1, SHEET2, SHEET3, SHEET1 (2), SHEET2 (2), SHEET3 (2)

Not quite there yet, to achieve:
SHEET1, SHEET2, SHEET3, SHEET1 E, SHEET1 F, SHEET2 E, SHEET2 F, SHEET3
E, SHEET3 F

Thank you!! :oD


Can anyone point me in the right direction, at least? I'm not a
natural at this by any means, as many of you know, but I can continue
to try finding what's needed if someone could at least pass along some
code to search for that might help. That's always been the problem,
not knowing the terms to search for so even the help file is difficult
to wade through.

Thanks so much. I guess it's a difficult one, this one, eh? :oD

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default Duplicate sheets?

(I'm sorry, I'm guessing lots of people on holiday, etc., so didn't
want to bother the group with yet another request for help. I did
something I've never done before; I've signed up with a forum. The
new person starts Tuesday, so really needed a solution for this
workbook and I'm just not good enough to figure out big changes on my
own. I had great help over there. I certainly did not write this
code myself but hope it's okay to post the solution. I know that when
people google for questions and solutions, our posts help a lot. I've
certainly done more in last 6 months from googling than I've actually
posted, so I can attest to this! <g).

Here is a solution that I've tested and seems to work just great:

------------------------------------
Function ShExists(ShName As String) As Boolean
Dim ws As Worksheet

On Error Resume Next
Set ws = ThisWorkbook.Worksheets(ShName)
On Error GoTo 0

If Not ws Is Nothing Then ShExists = True
End Function
Sub DuplicateSheetsTWICE_Plus_Rename()
' This provides a means to split a large workbook with bilingual data
into two workbooks, languages separate.
' At this contract, complex mail merge was used on the bilingual one
which created headaches.
' - By splitting the book, half the logistical problems will be
eliminated.

Dim wks As Worksheet

For Each wks In ThisWorkbook.Worksheets
If Not ShExists(wks.Name & Chr(32) & "E") Then
wks.Copy After:=ThisWorkbook.Worksheets
(ThisWorkbook.Worksheets.Count)
ThisWorkbook.Worksheets
(ThisWorkbook.Worksheets.Count).Name _
= wks.Name & Chr(32) & "E"
End If
If Not ShExists(wks.Name & Chr(32) & "F") Then
wks.Copy After:=ThisWorkbook.Worksheets
(ThisWorkbook.Worksheets.Count)
ThisWorkbook.Worksheets
(ThisWorkbook.Worksheets.Count).Name _
= wks.Name & Chr(32) & "F"
End If
Next
End Sub
------------------------------------

Thank you. So this one is resolved.

Cheers! :oD

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
"Count" and "List" functions across sheets Meg Excel Worksheet Functions 0 October 14th 08 02:11 PM
Whats wrong with this? MyWBAccRep.Sheets("Volumes").Cells.Find("latest").Copy.Offset(0, Simon[_2_] Excel Programming 2 August 11th 08 01:29 PM
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Making changes on "grouped" sheets via code Conan Kelly Excel Programming 4 February 13th 08 01:04 AM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM


All times are GMT +1. The time now is 03:48 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"