VBA looping through specific columns

pvman

New Member
Joined
Apr 4, 2006
Messages
37
Office Version
  1. 2010
Platform
  1. Windows
Hello All
I am looking for a way to loop through specific columns
i.e. columns # 27,30,38,39,47,48,50,52,53,54,61,72,74,75,76,77,78,79
and in each of those columns, copy a formula from the first cell at the top of that specific column, down to all the rows in that column (lets say from line 3 to line 1000).
Each column have a different formula at the first upper cell.
Any thoughts how to go about it?
TIA
 
Last edited:
How about
Rich (BB code):
Sub pvman()
    Dim Txt As String
    Dim UsdRws As Long
    Dim Rng As Range
    
    Txt = "AA:AA,AD:AD,AL:AM,AU:AV,AZ:BA,BB:BB,BI:BI,BT:BT,BV:CB,CD:DA"
    UsdRws = Range("A" & Rows.Count).End(xlUp).Row
    For Each Rng In Range(Txt).Areas
        With Rng.Resize(1).Offset(2)
            .FormulaR1C1 = Rng.Resize(1).FormulaR1C1
            .Resize(UsdRws - 2).FillDown
        End With
    Next Rng
End Sub
 
Upvote 0

Excel Facts

Square and cube roots
The =SQRT(25) is a square root. For a cube root, use =125^(1/3). For a fourth root, use =625^(1/4).
Glad to help & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,213,520
Messages
6,114,099
Members
448,548
Latest member
harryls

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