Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

trying to get a rang to work in a formula through VBA 1

Status
Not open for further replies.

itmasterw

Programmer
Apr 13, 2003
147
US
Hi,
I am writing out a sum of cells, in an Excel spread sheet, from my VBA in Access. It will go through a loop first summing C4:C11 and then D4:D11 and so on. Each time this will be different, the program figures out how far it will go. In any case I need to do something like this:
Range(Chr$(a) & Val(b)).Select

ActiveCell.Formula = "=SUM('" & Chr$(a) & "' & '" & Val(s) & "' & : & '" & Chr$(a) & "' & '" & Val(t) & "')"

Which would be the equivalent to ActiveCell.Formula = "=SUM(C4:C11). Naturally, each time the variables are incremented. Any ideas on how I can get this to work I would appreciate.
Thank You


ITM
 
Something like this ?
myXLobj.Range(Chr$(a) & b).Formula = "=SUM(" & Chr$(a) & s & ":" & Chr$(a) & t & ")"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top