Yeah, but depending upon what the OP is trying to accomplish, there may be a better way than using VBA. Just trying to get all information or as Joe Friday would've said "Just the facts", so that the OP gets the best solution.
I needed to clip off that last pesky "+" when I finish the Do Loop. Here's me code for the first foumula...not very graceful but effective. It beats having to manually edit 20 formulas.
Sub CreateNewFormulas()
'This routine creates the new formulas and is used when a controller is added to or deleted from the workbook.
'Range("Incl" & i) is the reference point for the controller.
Dim NC As Integer, i As Integer, myString As String
NC = 65 'The number of controllers
i = 1
Do Until i > NC
myString = myString & Range("Incl" & i).Offset(1, 0).Address & "+"
i = i + 1
Loop
Range("UtilFactor").Formula = "=" & Left(myString, Len(myString) - 1)
End Sub
Thanks as always for the prompt and effective assistance!!
Sub CreateNewFormulas()
Dim NC As Integer, i As Integer
NC = 65
i = 2
Range("UtilFactor").Formula = "=sum($" & Incl & "$" & i & ":$" & Incl & NC + i -1 & ")"
End Sub
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.