Loop - copy & paste

Vishaal

Well-known Member
Joined
Mar 16, 2019
Messages
543
Office Version
  1. 2010
  2. 2007
Platform
  1. Windows
  2. Web
Hi,

Thanks in advance,

I am copying the formula from Range ("A12:A24")
And after select the next range ("B12") and paste it
Again select the next range ("C12") and paste it
Again select the next range ("D12") and paste it

How can i do it through loop or vba (Coloumn B to AY)
 
Thanks flluff Sir ji

I want to do it through loop

Because data is large

And using the loop excel is not hang or we dont need to restart the excel
 
Upvote 0

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Looping is slower & will probably cause more problems.
If you have lots of formula, try
Code:
Sub Vishaal()
   Application.Calculation = xlCalculationManual
   Range("B12:AY24").Value = Range("A12:A24").Value
   Application.Calculation = xlCalculationAutomatic
End Sub
 
Upvote 0
In this code

Can we paste values instead of formula

It is possible


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
 
Last edited:
Upvote 0
For values only use
Code:
Sub Vishaal()
   Range("B12:AY24").Value = Range("A12:A24").Value
End Sub



I have just used it

U r right

Its really fast

But problem is its providing the value of A12:A24 in all
Instead of different values for B12, C12,D12
 
Upvote 0
Pls provide the complete vba code
you still cal add to below
Code:
 Sub copy_formula()
[A12:A24].copy [B12:AY24]
    With Range("b12:ay24")
        
        .Value = .Value
    End With
End Sub
 
Last edited:
Upvote 0
Pls elaborate, unable to understand

I am not a professional vba developer

Pls add this with previous code, pls pls

Thanks again for your help
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,239
Members
452,621
Latest member
Laura_PinksBTHFT

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top