View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default How to set conditional format with vba?

xlapp.Workbooks(strXlsFile).Worksheets(sn(i)).Rang e _
("D2:D" & lr).Formula = "=C2-B2"


xlapp.Workbooks(strXlsFile).Worksheets(sn(i)).Rang e _
("F2:F" & lr).Formula = "=STDEV(B2:" & cells(2,lc).Address(0,0) _
& ")"

But this would cause a circular reference if lc is greater than column F.

--
Regards,
Tom Ogilvy



"deko" wrote in message
m...
A similar problem - trying to fill a formula down:

I want column D to show the difference between B and C

D2 = C2-B2
D3 = C3-B3
D4 = C4-B4
and so on

I've figured out how to fill STDEV like this:

xlapp.Workbooks(strXlsFile).Worksheets(sn(i)).Rang e _
("F2:F" & lr).Formula = "=STDEV(" & xlapp.Workbooks _
(strXlsFile).Worksheets(sn(i)).Range(xlapp.Workboo ks _
(strXlsFile).Worksheets(sn(i)).Cells(2, 7), _
xlapp.Workbooks(strXlsFile).Worksheets(sn(i)).Cell s _
(2, lc)).Address(0, 0) & ")"

But how do I fill a formula that simply subtracts?

Thanks again...