PDA

View Full Version : synthax of Cells.offset.value



Ramo964516
03-14-2016, 11:08 AM
Hi everybody,

I have a few code lines and i don't know what it doesn"t work.

Dim strValSumMonth As String
strValSumMonth = "=SUMIF(" & Cells(i, j).Resize(, 4).Address(False, False) & ";" & Chr(34) & "OK" & Chr(34) & ";" & Range(strAdresseOKpasOk).Resize(, 4).Address(False, False) & ")"

Cells(i, j).Offset(0, 5).Value = strValSumMonth

the value of strValSUmMonth is for exemple =SUMIF(Z34:AC34;"OK";Z3:AC3)

the bug here is in the last code line.
Any help please ?

Paul_Hossler
03-14-2016, 11:29 AM
Try this



Cells(i, j).Offset(0, 5).Formula = strValSumMonth


(I hope I and J as correct)

Bob Phillips
03-14-2016, 02:55 PM
Try this


Dim strValSumMonth As String
strValSumMonth = "=SUMIF(" & Cells(i, j).Resize(, 4).Address(False, False) & "," & _
"""OK""" & Chr(34) & "," & _
Range(strAdresseOKpasOk).Resize(, 4).Address(False, False) & ")"
Cells(i, j).Offset(0, 5).Value = strValSumMonth