Easy, hopefully: Copying Formulas (but so they don't appear in all rows)

mlarson

Well-known Member
Joined
Aug 25, 2011
Messages
509
Office Version
  1. 2010
Platform
  1. Windows
Hi all, I believe this is probably a fairly easy problem, but I don't know the answer and would appreciate your help. The code below extends GoalSeek for a large number of cells (say, 100,000). But it is dependent on formulas I have in cells G3:W3. More specifically, values in B3 are dependent on G3:W3.

As my spreadsheet will have 100,000 rows or more, I don't want the formulas in G3:W3 to have to be copied into G4:W4, G5:W5, etc. I would prefer the formulas are only in cells G3:W3. But I still want the values in B4, B5, etc. to be dependent on G4:W4, G5:W5, etc.

Can the code below be edited, or can an additional code be created, that would accomplish this objective? I hope I am being clear. I have not provided the actual formulas in G3:W3 for simplicity's sake. If they are needed, please let me know.

Code:
Sub ml()
    Dim cell As Range
    For Each cell In Range("C3", Cells(Rows.Count, "C").End(xlUp))
        cell.GoalSeek Goal:=cell.Offset(, -1).Value2, _
                      ChangingCell:=cell.Offset(, 3)
    Next cell
End Sub</pre>
 

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.

Forum statistics

Threads
1,224,603
Messages
6,179,850
Members
452,948
Latest member
UsmanAli786

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