Consulting

Results 1 to 3 of 3

Thread: synthax of Cells.offset.value

  1. #1

    synthax of Cells.offset.value

    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 ?
    Last edited by Ramo964516; 03-14-2016 at 11:40 AM.

  2. #2
    VBAX Sage
    Joined
    Apr 2007
    Location
    United States
    Posts
    8,730
    Location
    Try this

    Cells(i, j).Offset(0, 5).Formula = strValSumMonth
    (I hope I and J as correct)
    ---------------------------------------------------------------------------------------------------------------------

    Paul


    Remember: Tell us WHAT you want to do, not HOW you think you want to do it

    1. Use [CODE] ....[/CODE ] Tags for readability
    [CODE]PasteYourCodeHere[/CODE ] -- (or paste your code, select it, click [#] button)
    2. Upload an example
    Go Advanced / Attachments - Manage Attachments / Add Files / Select Files / Select the file(s) / Upload Files / Done
    3. Mark the thread as [Solved] when you have an answer
    Thread Tools (on the top right corner, above the first message)
    4. Read the Forum FAQ, especially the part about cross-posting in other forums
    http://www.vbaexpress.com/forum/faq...._new_faq_item3

  3. #3
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    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
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •