Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default Copying sheet tab "x" number of times

I have a sheet tab that is named "MASTER". I am trying to write a macro that
will copy this sheet tab multiple times based upon the value in cell A1 of a
sheet tab called "QTY". For example, if the value on the QTY tab is "4", the
"MASTER" tab will be copied 4 times---always placing the new tab at the "end"
of the sheet tab block. Can someone help with this?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 694
Default Copying sheet tab "x" number of times

Hi,

Use the CopyTabN sub from this thread:
<http://www.microsoft.com/office/community/en-us/default.mspx?dg=microsoft.public.excel.programming &mid=5bc775be-d632-41a3-8306-03c5d6cd9f90

and call it as:

Sub Test()
CopyTabN Thisworkbook.Worksheets("MASTER") _
, CLng(Thisworkbook.Worksheets("QTY").Range("A1").va lue)
End Sub

--
Regards,
Sébastien
<http://www.ondemandanalysis.com


"JDaywalt" wrote:

I have a sheet tab that is named "MASTER". I am trying to write a macro that
will copy this sheet tab multiple times based upon the value in cell A1 of a
sheet tab called "QTY". For example, if the value on the QTY tab is "4", the
"MASTER" tab will be copied 4 times---always placing the new tab at the "end"
of the sheet tab block. Can someone help with this?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 169
Default Copying sheet tab "x" number of times

Since I'm relatively new to the Excel object model, I usually start out by
creating a macro to do what I want (in this case, copy the Master worksheet
to the end of the workbook). Then I'll add the code I need around that.
Something like:

Public Sub CopySheet

Dim intLoop as integer

intLoop = 1
Do While intLoop <= ActiveWorkbook.Sheets("SheetName").Cells("A1")

'put your copy code in here
'you might want to add some code that changes the names of the
'copy by appending the intLoop value to the word "Copy"

intLoop = intLoop + 1
Loop

End Sub

HTH
Dale
--
Don''t forget to rate the post if it was helpful!

Email address is not valid.
Please reply to newsgroup only.


"JDaywalt" wrote:

I have a sheet tab that is named "MASTER". I am trying to write a macro that
will copy this sheet tab multiple times based upon the value in cell A1 of a
sheet tab called "QTY". For example, if the value on the QTY tab is "4", the
"MASTER" tab will be copied 4 times---always placing the new tab at the "end"
of the sheet tab block. Can someone help with this?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Copying sheet tab "x" number of times


Sub addshts()
For i = 1 To InputBox("Enter sheets desired") - 1
Sheets("Master").Copy After:=Sheets("Master")
Next i
End Sub
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"JDaywalt" wrote in message
...
I have a sheet tab that is named "MASTER". I am trying to write a macro
that
will copy this sheet tab multiple times based upon the value in cell A1 of
a
sheet tab called "QTY". For example, if the value on the QTY tab is "4",
the
"MASTER" tab will be copied 4 times---always placing the new tab at the
"end"
of the sheet tab block. Can someone help with this?


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
Need to know the number of times "fam" appears in a list of cells medpay Excel Discussion (Misc queries) 6 October 4th 07 07:36 PM
Copying a formatted "template" sheet and naming new sheet via user form Neale[_2_] Excel Programming 1 May 31st 07 04:02 PM
counting the number of times value of "x" appears in a row Hugh Excel Discussion (Misc queries) 2 August 2nd 06 12:17 PM
How to make number of "static" fields stay the same when copying? MrHaugen Excel Discussion (Misc queries) 2 July 11th 06 08:40 PM
Duplicate entry "x" number of times gennario Excel Discussion (Misc queries) 1 April 7th 06 11:57 PM


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