Results 1 to 8 of 8

Thread: loop through and copy non empty cell values to email body with each headers

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #2
    VBAX Contributor rollis13's Avatar
    Joined
    Jun 2013
    Location
    Cordenons
    Posts
    149
    Location
    This is the best I managed to do. I'm taking advantage of the fact that you merged the cells for your headers.
    By the way, I have no idea how to format headers bold unless you use HTML to create the body of your email.
    '...
    For Each cell In wsVR.Range("L11:L83")
        If Not IsEmpty(cell) Then
            If cell.Offset(0, -11).Value <> "" Then obs = obs & vbNewLine & vbNewLine & cell.Offset(0, -11) '<- added
            obs = obs & vbNewLine & cell.Value
        End If
    Next cell
    '...
    *** Sorry, I just found a bug, my edit only works if in column L the section has an observation in the first row (as per your example), elsewise, it will not add the header to obs.
    Last edited by rollis13; 08-01-2022 at 03:13 PM.

Posting Permissions

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