View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Using VB to fill a formula down

Set rng = oSheet.Range("A1").CurrentRegion.Columns(1).Cells
set rng = rng.offset(1,0).Resize(rng.rows.count-1)
rng.offset(0,5).Formula = "=A2+B2+C2+D2"

as an example.

--
Regards,
Tom Ogilvy


"eli silverman" wrote in message
...
I have written an app in VB6 that creates an Excel spreadsheet from an

ADODB recordset.
I need to use VB during the creation to add a number ot totals columns.
I have the variable osheet declared as an object and can execute the

command:
osheet.range("E8").value = "=a8+b8+c8+d8".
What I need to know is how to fill this formula down the spreadsheet for

all the rows
returned by the adodb recordset. i.e. ..."e9").value = "=a9+b9+c9+d9" ...

etc
I can have up to about 9 or 10 totals columns like this that I need to add

and
the adodb recordset can range from 1 to over 1200 records.
Any help would be greatly appreciated.