Results 1 to 6 of 6

Thread: Duplicating columns Urgent request

  1. #1
    Seeker rakeshbrraag's Avatar
    Join Date
    Nov 2012
    Posts
    10
    Articles
    0
    Excel Version
    2013

    Lightbulb Duplicating columns Urgent request



    Register for a FREE account, and/
    or Log in to avoid these ads!

    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

  2. #2
    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

  3. #3
    Seeker rakeshbrraag's Avatar
    Join Date
    Nov 2012
    Posts
    10
    Articles
    0
    Excel Version
    2013
    Quote Originally Posted by Bob Phillips View Post
    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.

  4. #4
    That is four cells. 4 into 1 doesn't go. How do you want to spread it.

  5. #5
    Seeker rakeshbrraag's Avatar
    Join Date
    Nov 2012
    Posts
    10
    Articles
    0
    Excel Version
    2013
    Quote Originally Posted by Bob Phillips View Post
    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

  6. #6
    Now I understand less than I did before you replied.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •