View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
RadarEye RadarEye is offline
external usenet poster
 
Posts: 78
Default Using Sumif In A Macro

Hi Timbo

In Excel 2003 I have created this:

Sub CreateSumIf()
Dim CopyFromTo As String
Dim ShtNm As String
Dim sFormula As String

CopyFromTo = ("CopyfromTo")

ShtNm = WorksheetName
Range("I1").Select

sFormula = "=SumIf(" & ShtNm & "!$D$6:$D$51, " & _
CopyFromTo & "!E1," & ShtNm & "!$I$6:$I$51)"

Range("I1").Formula = sFormula
End Sub

HTH,

Wouter