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 Problem with Sumif and Right()

xlrng2 & 4 are Dim as Range
xlApp.Range("m21") = xlApp.WorksheetFunction.SumIf(xlRng2, "*CPCT",xlRng4)

--
Regards,
Tom Ogilvy


"JEff" wrote in message
...
I am trying to use sumif to add up a column of data. The hitch is I want

to
compare the last four right characters of each line contained in the

range.
My code is

xlrng2 & 4 are Dim as Range
xlApp.Range("m21") = xlApp.WorksheetFunction.SumIf(Right(xlRng2, 4),

"CPCT",
xlRng4)