Macro for column of formulas

newshound12

Active Member
Joined
Feb 19, 2003
Messages
339
Have column of formulas from FE7 to FE26. It starts with =CD31 and
ends with =CD202. Each =CD is 9 apart from the previous cell.
Need a macro to run these formulas and convert them to values
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
So your saying 9 apart:

Like CD31 then CD41


Is that correct?
 
Last edited:
Upvote 0
If the answer to my question is yes then try this:
Code:
Sub Cell_Values()
'Modified 11/7/2019 12:46:40 AM  EDT
Application.ScreenUpdating = False
Dim i As Long
Dim n As Long
n = 31
    For i = 7 To 26
        Cells(i, "FE").Value = Cells(n, "CD").Value
        n = n + 10
    Next
Application.ScreenUpdating = True
End Sub
 
Upvote 0
Here's my attempt:

Code:
Option Explicit
Sub Macro1()

    Dim rngMyCell As Range
    Dim lngMyRow As Long
    
    Application.ScreenUpdating = False
    
    For Each rngMyCell In Range("FE7:FE26")
        If lngMyRow = 0 Then
            lngMyRow = 31
        Else
            lngMyRow = lngMyRow + 9
        End If
        rngMyCell.Formula = "=CD" & lngMyRow
    Next rngMyCell
    
    Application.ScreenUpdating = True

End Sub

Regards,

Robert
 
Upvote 0
If you are interested, here is a way that you can do them all at once.

Rich (BB code):
Sub FillCells()
  With Range("FE7:FE26")
    .Formula = "=INDEX(CD$31:CD$202,ROWS(FE$7:FE7)*9-8)"
    .Value = .Value
  End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,884
Messages
6,175,171
Members
452,615
Latest member
bogeys2birdies

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