Duplicating columns Urgent request

rakeshbrraag

New member
Joined
Nov 23, 2012
Messages
10
Reaction score
0
Points
0
Excel Version(s)
2013
Hello everyone,

I have a problem with the macro code.

First part:
I want to duplicate a sheet ( in my case the sheet name is "template") N number of times. This N times value is specified by cell V4 in specific sheet( in my case sheet nam is "row" and V4=4). Each duplicated sheets has to be renamed by different names

Second Part:

Now in all the duplicated sheets we have a cell C2. I have to insert the data from cell T1,T2,T3,T4 from sheet "row" and paste it in cell C2 of the duplicated rows respectfully.

Many thanks in advance
 

Bob Phillips

Super Moderator
Staff member
Joined
Mar 21, 2011
Messages
1,942
Reaction score
0
Points
36
Excel Version(s)
O365
Code:
Sub DuplicateData()Dim i As Long


    With Worksheets("row")
    
        For i = 1 To .Range("V4").Value
        
            Worksheets("template").Copy after:=Worksheets(Worksheets.Count)
            ActiveSheet.Name = "T" & i
            .Range("C2").Copy ActiveSheet.Cells(i, "T")
        Next i
    End With
End Sub
 

rakeshbrraag

New member
Joined
Nov 23, 2012
Messages
10
Reaction score
0
Points
0
Excel Version(s)
2013
Code:
Sub DuplicateData()Dim i As Long


    With Worksheets("row")
    
        For i = 1 To .Range("V4").Value
        
            Worksheets("template").Copy after:=Worksheets(Worksheets.Count)
            ActiveSheet.Name = "T" & i
            .Range("C2").Copy ActiveSheet.Cells(i, "T")
        Next i
    End With
End Sub

Thank you for the code. Actually there is a small change, I have to insert the data from cell T4,T5,T6,T7 from sheet "row" and paste it in cell C2 of the duplicated rows respectfully. Can you please do the changes to the code. Sorry for the change.
 

Bob Phillips

Super Moderator
Staff member
Joined
Mar 21, 2011
Messages
1,942
Reaction score
0
Points
36
Excel Version(s)
O365
That is four cells. 4 into 1 doesn't go. How do you want to spread it.
 

rakeshbrraag

New member
Joined
Nov 23, 2012
Messages
10
Reaction score
0
Points
0
Excel Version(s)
2013
That is four cells. 4 into 1 doesn't go. How do you want to spread it.


I want to modify the code so that It inserts the data from cell T4,T5,T6,T7 from sheets row( Actually the value of V4 is nothing but the number of rows in T column) from sheet "row" and paste it in cell C2 of the duplicated rows respectfully(4 cell values into 4 sheets). Can you please help me. Thanks in advance
 

Bob Phillips

Super Moderator
Staff member
Joined
Mar 21, 2011
Messages
1,942
Reaction score
0
Points
36
Excel Version(s)
O365
Now I understand less than I did before you replied.
 
Top