Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 41

Thread: Loop - copy & paste
Thanks Thanks: 0 Likes Likes: 0

  1. #21
    Board Regular
    Join Date
    Mar 2019
    Posts
    205
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Loop - copy & paste

    Quote Originally Posted by mohadin View Post
    Code:
    Sub copy_formula()Application.ScreenUpdating = False
        With ActiveSheet
        Set Rng = Range("a12:a24")
       Rng.copy
            For i = 2 To 50
               .Cells(12, i).PasteSpecial Paste:=xlPasteFormulas
            Next
     With Range("b12:ay24")
        .Value = .Value
        End With
        End With
       Application.ScreenUpdating = True
    End Sub


    Ok checking

    Pls give me time

    Thanks bro

  2. #22
    Board Regular
    Join Date
    Mar 2015
    Location
    Syria
    Posts
    269
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Loop - copy & paste

    Which code you talking abut

  3. #23
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,316
    Post Thanks / Like
    Mentioned
    471 Post(s)
    Tagged
    47 Thread(s)

    Default Re: Loop - copy & paste

    Quote Originally Posted by Vishaal View Post
    But problem is its providing the value of A12:A24 in all
    Instead of different values for B12, C12,D12
    In that case what values do you want in those cells?
    You said you wanted A12:A24 pasted in col B onwards.
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  4. #24
    Board Regular
    Join Date
    Mar 2015
    Location
    Syria
    Posts
    269
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Loop - copy & paste

    Quote Originally Posted by Fluff View Post
    In that case what values do you want in those cells?
    You said you wanted A12:A24 pasted in col B onward.
    Hi Mr.Fluff
    As I understand he whats to copy formulas A12:A24 to col B onward then get the values of the copied formulas
    Last edited by mohadin; Aug 31st, 2019 at 09:12 AM.

  5. #25
    Board Regular
    Join Date
    Mar 2019
    Posts
    205
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Loop - copy & paste

    Quote Originally Posted by mohadin View Post
    Hi Mr.Fluff
    As I understand he whats to copy formulas A12:A24 to col B onward then get the values of the copied formulas



    Yes

    You are right

  6. #26
    Board Regular
    Join Date
    Mar 2019
    Posts
    205
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Loop - copy & paste

    Quote Originally Posted by mohadin View Post
    Code:
    Sub copy_formula()Application.ScreenUpdating = False
        With ActiveSheet
        Set Rng = Range("a12:a24")
       Rng.copy
            For i = 2 To 50
               .Cells(12, i).PasteSpecial Paste:=xlPasteFormulas
            Next
     With Range("b12:ay24")
        .Value = .Value
        End With
        End With
       Application.ScreenUpdating = True
    End Sub


    Mohadin Sir Ji

    Its Fantastic

    Its working Great

    Many Thanks Sir Ji

  7. #27
    MrExcel MVP
    Moderator
    Fluff's Avatar
    Join Date
    Jun 2014
    Location
    Chippenham
    Posts
    28,316
    Post Thanks / Like
    Mentioned
    471 Post(s)
    Tagged
    47 Thread(s)

    Default Re: Loop - copy & paste

    In that case try
    Code:
    Sub Vishaal()
      Range("A12:A24").Copy Range("B12:AY24")
      Range("B12:AY24").Value = Range("B12:AY24").Value
    End Sub
    - Posting Data try one of these tools
    - Posting guidelines, forum rules and terms of use
    - Read the FAQs

    Running Office 365 on Win 10

  8. #28
    Board Regular
    Join Date
    Mar 2015
    Location
    Syria
    Posts
    269
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Loop - copy & paste

    Quote Originally Posted by Vishaal View Post
    Mohadin Sir Ji

    Its Fantastic

    Its working Great

    Many Thanks Sir Ji
    Great

  9. #29
    Board Regular
    Join Date
    Mar 2019
    Posts
    205
    Post Thanks / Like
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Loop - copy & paste

    Quote Originally Posted by mohadin View Post
    Great

    Mohadin Sir Ji

    In your code second work

    With Range("b12:ay24")
    .Value = .Value
    End With
    End With
    Application.ScreenUpdating = True
    End Sub

    When its start working, excel hang and we need to restart

    Can it is possible
    1. It also work in loop as your code first part
    2. In your code first part, code will first copy formula and paste and after that same time copy that coloumn and paste values

    Pls help sir

  10. #30
    Board Regular
    Join Date
    Mar 2015
    Location
    Syria
    Posts
    269
    Post Thanks / Like
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Loop - copy & paste

    Well
    I don't know what the formulas are in your sheet
    and what is yous the excel version, here in 2013 work fine
    Any way try

    Code:
    Sub
     copy_formula()
    Application.ScreenUpdating = False
    Application.Calculation = xlCalculationManual
        With ActiveSheet
        Set Rng = Range("a12:a24")
       Rng.Copy
            For i = 2 To 50
               .Cells(12, i).PasteSpecial Paste:=xlPasteFormulas
            Next
            Application.Calculation = xlCalculationAutomatic
     With Range("b12:ay24")
        .Value = .Value
        End With
        End With
       Application.ScreenUpdating = True
    End Sub

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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