Thread: Totals
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
bhofsetz[_64_] bhofsetz[_64_] is offline
external usenet poster
 
Posts: 1
Default Totals


Here's a simplified version of your code.
You can use one SumString and just add it to itself repeatedly.


Code:
--------------------
Sub Totals()

Dim Start As String
Dim EndPart As String
Dim Spacer As Integer
Dim SumString As String
Dim Argument As Integer
Dim Counter As Integer
Dim Num As Integer

Spacer = 4
Start = "R[-"
EndPart = "]C"
Argument = Spacer
Num = InputBox("How many portfolio companies are there? ")
SumString = "=R[-4]C"
For Counter = 2 To Num
Argument = Counter * Spacer
SumString = SumString & "+" & Start & Argument & EndPart
Next Counter
MsgBox ("He " & SumString)
End Sub
--------------------


HTH


--
bhofsetz
------------------------------------------------------------------------
bhofsetz's Profile: http://www.excelforum.com/member.php...o&userid=18807
View this thread: http://www.excelforum.com/showthread...hreadid=381238